source: trunk/tools/designer/plugins/cppeditor/cppbrowser.cpp

Last change on this file was 197, checked in by rudi, 14 years ago

Added QtDesigner

File size: 2.3 KB
Line 
1/**********************************************************************
2**
3** Copyright (C) 2000-2007 Trolltech ASA. All rights reserved.
4**
5** This file is part of Qt Designer.
6**
7** This file may be distributed and/or modified under the terms of the
8** GNU General Public License version 2 as published by the Free Software
9** Foundation and appearing in the file LICENSE.GPL included in the
10** packaging of this file.
11**
12** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
13** licenses may use this file in accordance with the Qt Commercial License
14** Agreement provided with the Software.
15**
16** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
17** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18**
19** See http://www.trolltech.com/gpl/ for GPL licensing information.
20** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
21** information about Qt Commercial License Agreements.
22**
23** Contact info@trolltech.com if any conditions of this licensing are
24** not clear to you.
25**
26**********************************************************************/
27
28#include "cppbrowser.h"
29#include <private/qrichtext_p.h>
30#include <qprocess.h>
31#include <qmainwindow.h>
32#include <qstatusbar.h>
33#include <editor.h>
34
35CppEditorBrowser::CppEditorBrowser( Editor *e )
36 : EditorBrowser( e )
37{
38}
39
40void CppEditorBrowser::showHelp( const QString &w )
41{
42 QString word( w );
43 if ( word[ 0 ] == 'Q' ) {
44 if ( word[ (int)word.length() - 1 ] == '&' ||
45 word[ (int)word.length() - 1 ] == '*' )
46 word.remove( word.length() - 1, 1 );
47 word = word.lower() + ".html";
48 QStringList lst;
49 lst << "assistant" << "-file" << word;
50 QProcess proc( lst );
51 proc.start();
52 return;
53 }
54
55 if ( word.find( '(' ) != -1 ) {
56 QString txt = "::" + word.left( word.find( '(' ) );
57 QTextDocument *doc = curEditor->document();
58 QTextParagraph *p = doc->firstParagraph();
59 while ( p ) {
60 if ( p->string()->toString().find( txt ) != -1 ) {
61 curEditor->setCursorPosition( p->paragId(), 0 );
62 return;
63 }
64 p = p->next();
65 }
66 }
67
68 QMainWindow *mw = ::qt_cast<QMainWindow*>(curEditor->topLevelWidget());
69 if ( mw )
70 mw->statusBar()->message( tr( "Nothing available for '%1'" ).arg( w ), 1500 );
71}
Note: See TracBrowser for help on using the repository browser.