本文整理汇总了C++中QToolBar::setStretchableWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ QToolBar::setStretchableWidget方法的具体用法?C++ QToolBar::setStretchableWidget怎么用?C++ QToolBar::setStretchableWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QToolBar
的用法示例。
在下文中一共展示了QToolBar::setStretchableWidget方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QMainWindow
FifteenMainWindow::FifteenMainWindow(QWidget *parent, const char* name, WFlags fl)
: QMainWindow( parent, name, fl )
{
// random seed
srand(time(0));
setCaption( tr("Fifteen Pieces") );
QToolBar *toolbar = new QToolBar(this);
toolbar->setHorizontalStretchable( FALSE );
QMenuBar *menubar = new QMenuBar( toolbar );
menubar->setMargin(0);
QPopupMenu *game = new QPopupMenu( this );
menubar->insertItem( tr( "Game" ), game );
QWidget *spacer = new QWidget( toolbar );
spacer->setBackgroundMode( PaletteButton );
toolbar->setStretchableWidget( spacer );
setToolBarsMovable( FALSE );
QVBox *vbox = new QVBox( this );
PiecesTable *table = new PiecesTable( vbox );
setCentralWidget(vbox);
QAction *a = new QAction( tr( "Randomize" ), Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ),
QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), table, SLOT( slotRandomize() ) );
a->addTo( game );
a->addTo( toolbar );
a = new QAction( tr("Configure"), Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ),
QString::null, 0, this, 0 );
connect( a, SIGNAL( activated()), table, SLOT( slotConfigure()) );
a->addTo( game );
}
示例2: icon_back
HelpWindow::HelpWindow( const QString& home_, const QString& _path,
QWidget* parent, const char *name )
: QMainWindow( parent, name, WDestructiveClose ),
pathCombo( 0 ), selectedURL()
{
readHistory();
readBookmarks();
browser = new QTextBrowser( this );
browser->mimeSourceFactory()->setFilePath( _path );
browser->setFrameStyle( QFrame::Panel | QFrame::Sunken );
connect( browser, SIGNAL( textChanged() ),
this, SLOT( textChanged() ) );
setCentralWidget( browser );
if ( !home_.isEmpty() )
browser->setSource( home_ );
connect( browser, SIGNAL( highlighted( const QString&) ),
statusBar(), SLOT( message( const QString&)) );
resize( 640,700 );
QPopupMenu* file = new QPopupMenu( this );
file->insertItem( tr("&New Window"), this, SLOT( newWindow() ), ALT | Key_N );
file->insertItem( tr("&Open File"), this, SLOT( openFile() ), ALT | Key_O );
file->insertItem( tr("&Print"), this, SLOT( print() ), ALT | Key_P );
// The same three icons are used twice each.
QIconSet icon_back( QPixmap("textdrawing/previous.png") );
QIconSet icon_forward( QPixmap("textdrawing/next.png") );
QIconSet icon_home( QPixmap("textdrawing/home.png") );
QPopupMenu* go = new QPopupMenu( this );
backwardId = go->insertItem( icon_back,
tr("&Backward"), browser, SLOT( backward() ),
ALT | Key_Left );
forwardId = go->insertItem( icon_forward,
tr("&Forward"), browser, SLOT( forward() ),
ALT | Key_Right );
go->insertItem( icon_home, tr("&Home"), browser, SLOT( home() ) );
hist = new QPopupMenu( this );
QStringList::Iterator it = history.begin();
for ( ; it != history.end(); ++it )
mHistory[ hist->insertItem( *it ) ] = *it;
connect( hist, SIGNAL( activated( int ) ),
this, SLOT( histChosen( int ) ) );
bookm = new QPopupMenu( this );
bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) );
bookm->insertSeparator();
QStringList::Iterator it2 = bookmarks.begin();
for ( ; it2 != bookmarks.end(); ++it2 )
mBookmarks[ bookm->insertItem( *it2 ) ] = *it2;
connect( bookm, SIGNAL( activated( int ) ),
this, SLOT( bookmChosen( int ) ) );
menuBar()->insertItem( tr("&File"), file );
menuBar()->insertItem( tr("&Go"), go );
menuBar()->insertItem( tr( "History" ), hist );
menuBar()->insertItem( tr( "Bookmarks" ), bookm );
menuBar()->setItemEnabled( forwardId, FALSE);
menuBar()->setItemEnabled( backwardId, FALSE);
connect( browser, SIGNAL( backwardAvailable( bool ) ),
this, SLOT( setBackwardAvailable( bool ) ) );
connect( browser, SIGNAL( forwardAvailable( bool ) ),
this, SLOT( setForwardAvailable( bool ) ) );
QToolBar* toolbar = new QToolBar( this );
addToolBar( toolbar, "Toolbar");
QToolButton* button;
button = new QToolButton( icon_back, tr("Backward"), "", browser, SLOT(backward()), toolbar );
connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
button->setEnabled( FALSE );
button = new QToolButton( icon_forward, tr("Forward"), "", browser, SLOT(forward()), toolbar );
connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
button->setEnabled( FALSE );
button = new QToolButton( icon_home, tr("Home"), "", browser, SLOT(home()), toolbar );
toolbar->addSeparator();
pathCombo = new QComboBox( TRUE, toolbar );
connect( pathCombo, SIGNAL( activated( const QString & ) ),
this, SLOT( pathSelected( const QString & ) ) );
toolbar->setStretchableWidget( pathCombo );
setRightJustification( TRUE );
setDockEnabled( DockLeft, FALSE );
setDockEnabled( DockRight, FALSE );
pathCombo->insertItem( home_ );
browser->setFocus();
}
示例3: init
void QHTMLView::init()
{
QString qs;
QString qs2;
mpTextBrowser = new QTextBrowser(this);
mpTextBrowser->setTextFormat(Qt::RichText);
setCentralWidget(mpTextBrowser);
qs = xmlConfig->stringValue("HELP_INDEX");
qs2 = xmlConfig->stringValue("HELP_LAST_PAGE");
QFile qf1(qs);
if(qf1.exists()) mpTextBrowser->setSource(qs);
if(qs != qs2 )
{
QFile qf2(qs2);
if(qf2.exists()) mpTextBrowser->setSource(qs2);
}
QPopupMenu* file = new QPopupMenu( this );
file->insertItem( tr("&Open File"), this, SLOT( openFile() ), ALT | Key_O );
file->insertSeparator();
file->insertItem( tr("&Quit"), this, SLOT( close() ), ALT | Key_Q );
QPopupMenu* go = new QPopupMenu( this );
mIdBackward = go->insertItem(tr("&Backward"),mpTextBrowser,
SLOT( backward() ),ALT | Key_Left );
mIdForward = go->insertItem(tr("&Forward"),mpTextBrowser,
SLOT( forward() ),ALT | Key_Right );
go->insertItem(tr("&Home"),mpTextBrowser, SLOT( home() ) );
QPopupMenu* help = new QPopupMenu( this );
help->insertItem(tr("&About ..."),this,SLOT(about()));
#ifdef KDEAPP
KMenuBar* mb = new KMenuBar(this);
#else
QMenuBar* mb = new QMenuBar(this);
#endif
mb->insertItem(tr("&File"),file);
mb->insertItem(tr("&Go"),go);
mb->insertSeparator();
mb->insertItem(tr("&Help"),help );
mb->setItemEnabled( mIdForward, false);
mb->setItemEnabled( mIdBackward, false);
connect(mpTextBrowser, SIGNAL( backwardAvailable( bool ) ),
this, SLOT( setBackwardAvailable( bool ) ) );
connect(mpTextBrowser, SIGNAL( forwardAvailable( bool ) ),
this, SLOT( setForwardAvailable( bool ) ) );
connect(mpTextBrowser,SIGNAL(textChanged() ),this,
SLOT( slotTextChanged() ) );
QToolBar* toolbar = new QToolBar( this );
addToolBar( toolbar);
QToolButton* tb1;
mPixForward = QPixmap((const char **)forward_xpm);
mPixBackward = QPixmap((const char **)backward_xpm);
mPixHome = QPixmap((const char **)home_xpm);
tb1 = new QToolButton(mPixBackward, tr("Backward"), "", mpTextBrowser,
SLOT(backward()), toolbar );
connect(mpTextBrowser, SIGNAL( backwardAvailable(bool) ),tb1,
SLOT( setEnabled(bool) ) );
tb1->setEnabled( false );
tb1 = new QToolButton(mPixForward, tr("Forward"), "",mpTextBrowser,
SLOT(forward()), toolbar );
connect(mpTextBrowser,SIGNAL(forwardAvailable(bool) ),tb1,
SLOT( setEnabled(bool) ) );
tb1->setEnabled( false );
tb1 = new QToolButton(mPixHome, tr("Home"), "",this,
SLOT(home()), toolbar );
QWidget* dummy = new QWidget(toolbar);
toolbar->setStretchableWidget(dummy);
setRightJustification(true);
}
示例4: icon_back
//.........这里部分代码省略.........
setCentralWidget(browser);
if (!home_.isEmpty())
browser->setSource(home_);
connect(browser, SIGNAL(highlighted(const QString &)), statusBar(),
SLOT(message(const QString &)));
resize(640, 700);
QPopupMenu *file = new QPopupMenu(this);
file->insertItem(tr("&Imprimir"), this, SLOT(print()), CTRL + Key_I);
file->insertSeparator();
file->insertItem(tr("&Cerrar"), this, SLOT(close()), Key_Escape);
// The same three icons are used twice each.
QIconSet icon_back(QPixmap::fromMimeSource("previous.png"));
QIconSet icon_forward(QPixmap::fromMimeSource("next.png"));
QIconSet icon_home(QPixmap::fromMimeSource("home.png"));
QPopupMenu *go = new QPopupMenu(this);
backwardId =
go->insertItem(icon_back, tr("&Atrás"), browser, SLOT(backward()),
CTRL + Key_Left);
forwardId =
go->insertItem(icon_forward, tr("&Adelante"), browser,
SLOT(forward()), CTRL + Key_Right);
go->insertItem(icon_home, tr("&Inicio"), browser, SLOT(home()));
QPopupMenu *help = new QPopupMenu(this);
help->insertItem(tr("&Acerca ..."), this, SLOT(about()));
help->insertItem(tr("Acerca de &Qt ..."), this, SLOT(aboutQt()));
hist = new QPopupMenu(this);
QStringList::Iterator it = history.begin();
for (; it != history.end(); ++it)
mHistory[ hist->insertItem(*it)] = *it;
connect(hist, SIGNAL(activated(int)), this, SLOT(histChosen(int)));
bookm = new QPopupMenu(this);
bookm->insertItem(tr("Agregar Favorito"), this, SLOT(addBookmark()));
bookm->insertSeparator();
QStringList::Iterator it2 = bookmarks.begin();
for (; it2 != bookmarks.end(); ++it2)
mBookmarks[ bookm->insertItem(*it2)] = *it2;
connect(bookm, SIGNAL(activated(int)), this, SLOT(bookmChosen(int)));
menuBar() ->insertItem(tr("&Archivo"), file);
menuBar() ->insertItem(tr("&Ir"), go);
menuBar() ->insertItem(tr("Historial"), hist);
menuBar() ->insertItem(tr("Favoritos"), bookm);
menuBar() ->insertSeparator();
menuBar() ->insertItem(tr("&Ayuda"), help);
menuBar() ->setItemEnabled(forwardId, FALSE);
menuBar() ->setItemEnabled(backwardId, FALSE);
connect(browser, SIGNAL(backwardAvailable(bool)), this,
SLOT(setBackwardAvailable(bool)));
connect(browser, SIGNAL(forwardAvailable(bool)), this,
SLOT(setForwardAvailable(bool)));
QToolBar *toolbar = new QToolBar(this);
addToolBar(toolbar, "Toolbar");
QToolButton *button;
button =
new QToolButton(icon_back, tr("Atrás"), "", browser, SLOT(backward()),
toolbar);
connect(browser, SIGNAL(backwardAvailable(bool)), button,
SLOT(setEnabled(bool)));
button->setEnabled(FALSE);
button =
new QToolButton(icon_forward, tr("Adelante"), "", browser,
SLOT(forward()), toolbar);
connect(browser, SIGNAL(forwardAvailable(bool)), button,
SLOT(setEnabled(bool)));
button->setEnabled(FALSE);
button =
new QToolButton(icon_home, tr("Inicio"), "", browser, SLOT(home()),
toolbar);
toolbar->addSeparator();
pathCombo = new QComboBox(TRUE, toolbar);
connect(pathCombo, SIGNAL(activated(const QString &)), this,
SLOT(pathSelected(const QString &)));
toolbar->setStretchableWidget(pathCombo);
setRightJustification(TRUE);
setDockEnabled(DockLeft, FALSE);
setDockEnabled(DockRight, FALSE);
pathCombo->insertItem(home_);
browser->setFocus();
}
示例5: QToolButton
//.........这里部分代码省略.........
NeedConnection[new QToolButton ( *pixmap,
toolTip,
toolTip,
( *i ).second,
SLOT ( createWindow ( void ) ),
toolbar ) ] = ( *i ).second;
}
if ( menuName ) {
if ( pixmap )
ToolsMenu->insertItem ( *pixmap, menuName, toolID );
else
ToolsMenu->insertItem ( menuName, toolID );
ToolsMenu->setItemEnabled ( toolID, false );
}
if ( ( *i ).second->hasAbout() && menuName ) {
if ( !toolAbout ) {
toolAbout = new QPopupMenu ( this );
HelpMenu->insertItem ( "Tools", toolAbout );
}
if ( pixmap )
toolAbout->insertItem ( *pixmap, menuName, toolID + TO_ABOUT_ID_OFFSET );
else
toolAbout->insertItem ( menuName, toolID + TO_ABOUT_ID_OFFSET );
}
Tools[toolID] = ( *i ).second;
toolID++;
}
#ifndef TOOL_TOOLBAR
toolbar->setStretchableWidget ( new QLabel ( "", toolbar ) );
#endif
new QToolButton ( QPixmap ( ( const char ** ) connect_xpm ),
"Connect to database",
"Connect to database",
this, SLOT ( addConnection() ), toolbar );
DisconnectButton = new QToolButton ( QPixmap ( ( const char ** ) disconnect_xpm ),
"Disconnect current connection",
"Disconnect current connection",
this, SLOT ( delConnection() ), toolbar );
DisconnectButton->setEnabled ( false );
toolbar->addSeparator();
NeedConnection[new QToolButton ( QPixmap ( ( const char ** ) commit_xpm ),
"Commit connection",
"Commit connection",
this,SLOT ( commitButton() ),toolbar ) ] = NULL;
NeedConnection[new QToolButton ( QPixmap ( ( const char ** ) rollback_xpm ),
"Rollback connection",
"Rollback connection",
this,SLOT ( rollbackButton() ),toolbar ) ] = NULL;
toolbar->addSeparator();
ConnectionSelection = new QComboBox ( toolbar );
ConnectionSelection->setFixedWidth ( 200 );
ConnectionSelection->setFocusPolicy ( NoFocus );
connect ( ConnectionSelection, SIGNAL ( activated ( int ) ), this, SLOT ( changeConnection() ) );
menuBar() ->insertItem ( "&Tools", ToolsMenu, TO_TOOLS_MENU );
WindowsMenu = new QPopupMenu ( this );
WindowsMenu->setCheckable ( true );
connect ( WindowsMenu, SIGNAL ( aboutToShow() ), this, SLOT ( windowsMenu() ) );
menuBar() ->insertItem ( "&Window", WindowsMenu, TO_WINDOWS_MENU );
示例6: icon_back
HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* parent, const char *name )
: QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL()
{
readHistory();
readBookmarks();
browser = new QTextBrowser( this );
QStringList Strlist;
Strlist.append( home_);
browser->mimeSourceFactory()->setFilePath( Strlist );
browser->setFrameStyle( QFrame::Panel | QFrame::Sunken );
connect( browser, SIGNAL( textChanged() ),
this, SLOT( textChanged() ) );
setCentralWidget( browser );
if ( !home_.isEmpty() )
////////////////////////////////
browser->setSource( home_ );
////////////////////////////////
connect( browser, SIGNAL( highlighted(const QString&) ),
statusBar(), SLOT( message(const QString&)) );
setGeometry( 0,0,236,280);
QPopupMenu* file = new QPopupMenu( this );
// file->insertItem( tr("&New Window"), this, SLOT( newWindow() ), ALT | Key_N );
file->insertItem( tr("&Open File"), this, SLOT( openFile() ), ALT | Key_O );
// file->insertItem( tr("&Print"), this, SLOT( print() ), ALT | Key_P );
file->insertSeparator();
file->insertItem( tr("&Close"), this, SLOT( close() ), ALT | Key_Q );
// file->insertItem( tr("E&xit"), qApp, SLOT( closeAllWindows() ), ALT | Key_X );
// The same three icons are used twice each.
////F FIXME
QString pixs=(QDir::homeDirPath ()) +"/Applications/gutenbrowser/pix/";
QIconSet icon_back( QPixmap(pixs+"back.png") );
QIconSet icon_forward( QPixmap(pixs+"forward.png") );
QIconSet icon_home( QPixmap(pixs+"home.png") );
QPopupMenu* go = new QPopupMenu( this );
backwardId = go->insertItem( icon_back, tr("&Backward"), browser, SLOT( backward() ), ALT | Key_Left );
forwardId = go->insertItem( icon_forward, tr("&Forward"), browser, SLOT( forward() ), ALT | Key_Right );
go->insertItem( icon_home, tr("&Home"), browser, SLOT( home() ) );
hist = new QPopupMenu( this );
QStringList::Iterator it = history.begin();
for ( ; it != history.end(); ++it )
mHistory[ hist->insertItem( *it ) ] = *it;
connect( hist, SIGNAL( activated(int) ), this, SLOT( histChosen(int) ) );
bookm = new QPopupMenu( this );
bookm->insertItem( tr( "Add Bookmark" ), this, SLOT( addBookmark() ) );
bookm->insertSeparator();
QStringList::Iterator it2 = bookmarks.begin();
for ( ; it2 != bookmarks.end(); ++it2 )
mBookmarks[ bookm->insertItem( *it2 ) ] = *it2;
connect( bookm, SIGNAL( activated(int) ),
this, SLOT( bookmChosen(int) ) );
menuBar()->insertItem( tr("&File"), file );
menuBar()->insertItem( tr("&Go"), go );
menuBar()->insertItem( tr( "History" ), hist );
menuBar()->insertItem( tr( "Bookmarks" ), bookm );
// menuBar()->insertSeparator();
// menuBar()->insertItem( tr("&Help"), help );
menuBar()->setItemEnabled( forwardId, FALSE);
menuBar()->setItemEnabled( backwardId, FALSE);
connect( browser, SIGNAL( backwardAvailable(bool) ), this, SLOT( setBackwardAvailable(bool) ) );
connect( browser, SIGNAL( forwardAvailable(bool) ), this, SLOT( setForwardAvailable(bool) ) );
QToolBar* toolbar = new QToolBar( this );
addToolBar( toolbar, "Toolbar");
QToolButton* button;
button = new QToolButton( icon_back, tr("Backward"), "", browser, SLOT(backward()), toolbar );
connect( browser, SIGNAL( backwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
button->setEnabled( FALSE );
button = new QToolButton( icon_forward, tr("Forward"), "", browser, SLOT(forward()), toolbar );
connect( browser, SIGNAL( forwardAvailable(bool) ), button, SLOT( setEnabled(bool) ) );
button->setEnabled( FALSE );
new QToolButton( icon_home, tr("Home"), "", browser, SLOT(home()), toolbar );
toolbar->addSeparator();
pathCombo = new QComboBox( TRUE, toolbar );
connect( pathCombo, SIGNAL( activated(const QString&) ), this, SLOT( pathSelected(const QString&) ) );
toolbar->setStretchableWidget( pathCombo );
// pathCombo->setMaximumWidth(190);
//.........这里部分代码省略.........
示例7: QMainWindow
MainView::MainView(QWidget *parent, const char *name, WFlags fl) : QMainWindow(parent, name, fl)
{
setIcon( Resource::loadPixmap( "remote" ) );
setCaption(tr("uBrowser"));
setToolBarsMovable( false );
QToolBar *toolbar = new QToolBar(this, "toolbar");
back = new QToolButton(Resource::loadPixmap("ubrowser/back"), 0, 0, 0, 0, toolbar, "back");
forward = new QToolButton(Resource::loadPixmap("ubrowser/forward"), 0, 0, 0, 0, toolbar, "forward");
home = new QToolButton(Resource::loadPixmap("ubrowser/home"), 0, 0, 0, 0, toolbar, "home");
location = new QComboBox(true, toolbar, "location");
go = new QToolButton(Resource::loadPixmap("ubrowser/go"), 0, 0, 0, 0, toolbar, "go");
toolbar->setStretchableWidget(location);
toolbar->setHorizontalStretchable(true);
location->setAutoCompletion( true );
addToolBar(toolbar);
browser = new QTextBrowser(this, "browser");
setCentralWidget(browser);
//make the button take you to the location
connect(go, SIGNAL(clicked()), this, SLOT(goClicked()) );
connect(location->lineEdit(), SIGNAL(returnPressed()), this, SLOT(goClicked()) );
//make back, forward and home do their thing (isnt QTextBrowser great?)
connect(back, SIGNAL(clicked()), browser, SLOT(backward()) );
connect(forward, SIGNAL(clicked()), browser, SLOT(forward()) );
connect(home, SIGNAL(clicked()), browser, SLOT(home()) );
//make back and forward buttons be enabled, only when you can go back or forward (again, i love QTextBrowser)
//this doesnt seem to work, but doesnt break anything either...
connect(browser, SIGNAL(backwardAvailable(bool)), back, SLOT(setOn(bool)) );
connect(browser, SIGNAL(forwardAvailable(bool)), forward, SLOT(setOn(bool)) );
//notify me when the text of the browser has changed (like when the user clicks a link)
connect(browser, SIGNAL(textChanged()), this, SLOT(textChanged()) );
http = new HttpFactory(browser);
if( qApp->argc() > 1 )
{
char **argv = qApp->argv();
int i = 0;
QString *openfile = new QString( argv[0] );
while( openfile->contains( "ubrowser" ) == 0 && i < qApp->argc() )
{
i++;
*openfile = argv[i];
}
*openfile = argv[i+1];
if( !openfile->startsWith( "http://" ) && !openfile->startsWith( "/" ) )
{
openfile->insert( 0, QDir::currentDirPath()+"/" );
}
location->setEditText( *openfile );
goClicked();
}
}
示例8: makeMenu
void MainWindow::makeMenu()
{
QToolBar *toolBar = new QToolBar( this );
QToolBar *searchBar = new QToolBar(this);
QMenuBar *menuBar = new QMenuBar( toolBar );
QPopupMenu *searchMenu = new QPopupMenu( menuBar );
// QPopupMenu *viewMenu = new QPopupMenu( menuBar );
QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
QPopupMenu *searchOptions = new QPopupMenu( cfgMenu );
setToolBarsMovable( false );
toolBar->setHorizontalStretchable( true );
menuBar->insertItem( tr( "Search" ), searchMenu );
menuBar->insertItem( tr( "Settings" ), cfgMenu );
//SETTINGS MENU
cfgMenu->insertItem( tr( "Search" ), searchOptions );
QPopupMenu *pop;
for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){
pop = s->popupMenu();
if (pop){
cfgMenu->insertItem( s->text(0), pop );
}
}
//SEARCH
SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 );
SearchAllAction->setIconSet( Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ) );
// QWhatsThis::add( SearchAllAction, tr("Search everything...") );
connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) );
SearchAllAction->addTo( searchMenu );
searchMenu->insertItem( tr( "Options" ), searchOptions );
//SEARCH OPTIONS
//actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true );
//actionWholeWordsOnly->addTo( searchOptions );
actionCaseSensitiv = new QAction( tr("Case sensitive"),QString::null, 0, this, 0, true );
actionCaseSensitiv->addTo( searchOptions );
actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true );
actionWildcards->addTo( searchOptions );
//SEARCH BAR
LabelEnterText = new QLabel( searchBar, "Label" );
LabelEnterText->setAutoMask( FALSE );
LabelEnterText->setText( tr( "Search for: " ) );
LabelEnterText->setFrameStyle( QFrame::NoFrame );
LabelEnterText->setBackgroundMode( PaletteButton );
addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" );
QWhatsThis::add( searchEdit, tr("Enter your search terms here") );
searchEdit->setFocus();
searchBar->setHorizontalStretchable( TRUE );
searchBar->setStretchableWidget( searchEdit );
//Search button
SearchAllAction->addTo( searchBar );
//Clear text
ClearSearchText = new QToolButton( searchBar, "ClearSearchText");
ClearSearchText->setText( "" );
ClearSearchText->setPixmap( Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ) );
connect( searchEdit, SIGNAL( textChanged(const QString&) ),this, SLOT( setSearch(const QString&) ) );
connect( ClearSearchText, SIGNAL( clicked() ), searchEdit, SLOT( clear() ) );
}
示例9: setup
void FileMainWindow::setup()
{
QSplitter *splitter = new QSplitter( this );
dirlist = new DirectoryView( splitter, "dirlist", TRUE );
dirlist->addColumn( "Name" );
dirlist->addColumn( "Type" );
Directory *root = new Directory( dirlist, "/" );
root->setOpen( TRUE );
splitter->setResizeMode( dirlist, QSplitter::KeepSize );
fileview = new QtFileIconView( "/", splitter );
fileview->setSelectionMode( QIconView::Extended );
setCentralWidget( splitter );
QToolBar *toolbar = new QToolBar( this, "toolbar" );
setRightJustification( TRUE );
(void)new QLabel( tr( " Path: " ), toolbar );
pathCombo = new QComboBox( TRUE, toolbar );
pathCombo->setAutoCompletion( TRUE );
toolbar->setStretchableWidget( pathCombo );
connect( pathCombo, SIGNAL( activated( const QString & ) ),
this, SLOT ( changePath( const QString & ) ) );
toolbar->addSeparator();
QPixmap pix;
pix = QPixmap( cdtoparent_xpm );
upButton = new QToolButton( pix, "One directory up", QString::null,
this, SLOT( cdUp() ), toolbar, "cd up" );
pix = QPixmap( newfolder_xpm );
mkdirButton = new QToolButton( pix, "New Folder", QString::null,
this, SLOT( newFolder() ), toolbar, "new folder" );
connect( dirlist, SIGNAL( folderSelected( const QString & ) ),
fileview, SLOT ( setDirectory( const QString & ) ) );
connect( fileview, SIGNAL( directoryChanged( const QString & ) ),
this, SLOT( directoryChanged( const QString & ) ) );
connect( fileview, SIGNAL( startReadDir( int ) ),
this, SLOT( slotStartReadDir( int ) ) );
connect( fileview, SIGNAL( readNextDir() ),
this, SLOT( slotReadNextDir() ) );
connect( fileview, SIGNAL( readDirDone() ),
this, SLOT( slotReadDirDone() ) );
setDockEnabled( DockLeft, FALSE );
setDockEnabled( DockRight, FALSE );
label = new QLabel( statusBar() );
statusBar()->addWidget( label, 2, TRUE );
progress = new QProgressBar( statusBar() );
statusBar()->addWidget( progress, 1, TRUE );
connect( fileview, SIGNAL( enableUp() ),
this, SLOT( enableUp() ) );
connect( fileview, SIGNAL( disableUp() ),
this, SLOT( disableUp() ) );
connect( fileview, SIGNAL( enableMkdir() ),
this, SLOT( enableMkdir() ) );
connect( fileview, SIGNAL( disableMkdir() ),
this, SLOT( disableMkdir() ) );
}