本文整理汇总了C++中QToolButton::setPopup方法的典型用法代码示例。如果您正苦于以下问题:C++ QToolButton::setPopup方法的具体用法?C++ QToolButton::setPopup怎么用?C++ QToolButton::setPopup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QToolButton
的用法示例。
在下文中一共展示了QToolButton::setPopup方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
KexiDBDateTimeEdit::KexiDBDateTimeEdit(const QDateTime &datetime, QWidget *parent)
: QWidget(parent), KexiFormDataItemInterface()
{
m_invalidState = false;
m_cleared = false;
m_readOnly = false;
m_dateEdit = new Q3DateEdit(datetime.date(), this);
m_dateEdit->setAutoAdvance(true);
m_dateEdit->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
// m_dateEdit->setFixedWidth( QFontMetrics(m_dateEdit->font()).width("8888-88-88___") );
connect(m_dateEdit, SIGNAL(valueChanged(QDate)), this, SLOT(slotValueChanged()));
connect(m_dateEdit, SIGNAL(valueChanged(QDate)), this, SIGNAL(dateTimeChanged()));
QToolButton* btn = new QToolButton(this);
btn->setText("...");
btn->setFixedWidth(QFontMetrics(btn->font()).width(" ... "));
btn->setPopupDelay(1); //1 ms
m_timeEdit = new Q3TimeEdit(datetime.time(), this);
m_timeEdit->setAutoAdvance(true);
m_timeEdit->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
connect(m_timeEdit, SIGNAL(valueChanged(QTime)), this, SLOT(slotValueChanged()));
connect(m_timeEdit, SIGNAL(valueChanged(QTime)), this, SIGNAL(dateTimeChanged()));
#ifdef QDateTimeEditor_HACK
m_dte_date = KexiUtils::findFirstChild<QDateTimeEditor>(m_dateEdit, "QDateTimeEditor");
m_dte_time = KexiUtils::findFirstChild<QDateTimeEditor>(m_timeEdit, "QDateTimeEditor");
#else
m_dte_date = 0;
#endif
m_datePickerPopupMenu = new QMenu(0, "date_popup");
connect(m_datePickerPopupMenu, SIGNAL(aboutToShow()), this, SLOT(slotShowDatePicker()));
m_datePicker = new KDatePicker(m_datePickerPopupMenu, QDate::currentDate(), 0);
KDateTable *dt = KexiUtils::findFirstChild<KDateTable>(m_datePicker, "KDateTable");
if (dt)
connect(dt, SIGNAL(tableClicked()), this, SLOT(acceptDate()));
m_datePicker->setCloseButton(true);
m_datePicker->installEventFilter(this);
m_datePickerPopupMenu->insertItem(m_datePicker);
btn->setPopup(m_datePickerPopupMenu);
QHBoxLayout* layout = new QHBoxLayout(this);
layout->addWidget(m_dateEdit, 0);
layout->addWidget(btn, 0);
layout->addWidget(m_timeEdit, 0);
//layout->addStretch(1);
setFocusProxy(m_dateEdit);
}
示例2: QToolButton
//.........这里部分代码省略.........
WindowsMenu = new QPopupMenu ( this );
WindowsMenu->setCheckable ( true );
connect ( WindowsMenu, SIGNAL ( aboutToShow() ), this, SLOT ( windowsMenu() ) );
menuBar() ->insertItem ( "&Window", WindowsMenu, TO_WINDOWS_MENU );
menuBar() ->insertSeparator();
menuBar() ->insertItem ( "&Help", HelpMenu, TO_HELP_MENU );
char buffer[100];
sprintf ( buffer, DEFAULT_TITLE, TOVERSION );
setCaption ( buffer );
#ifdef TO_KDE
KDockWidget *mainDock = createDockWidget ( buffer, QPixmap ( ( const char ** ) toramini_xpm ) );
Workspace = new QWorkspace ( mainDock );
mainDock->setWidget ( Workspace );
setView ( mainDock );
setMainDockWidget ( mainDock );
mainDock->setEnableDocking ( KDockWidget::DockNone );
#else
Workspace = new QWorkspace ( this );
setCentralWidget ( Workspace );
#endif
setIcon ( QPixmap ( ( const char ** ) toramini_xpm ) );
statusBar() ->message ( "Ready" );
menuBar() ->setItemEnabled ( TO_CLOSE_CONNECTION, false );
menuBar() ->setItemEnabled ( TO_FILE_COMMIT, false );
menuBar() ->setItemEnabled ( TO_FILE_ROLLBACK, false );
menuBar() ->setItemEnabled ( TO_FILE_CLEARCACHE, false );
DisconnectButton->setEnabled ( false );
for ( std::map<QToolButton *, toTool *>::iterator j = NeedConnection.begin();
j != NeedConnection.end();j++ )
( *j ).first->setEnabled ( false );
connect ( menuBar(), SIGNAL ( activated ( int ) ), this, SLOT ( commandCallback ( int ) ) );
RowLabel = new QLabel ( statusBar() );
statusBar() ->addWidget ( RowLabel, 0, true );
RowLabel->setMinimumWidth ( 60 );
RowLabel->hide();
ColumnLabel = new QLabel ( statusBar() );
statusBar() ->addWidget ( ColumnLabel, 0, true );
ColumnLabel->setMinimumWidth ( 60 );
ColumnLabel->hide();
QToolButton *dispStatus = new toPopupButton ( statusBar() );
dispStatus->setIconSet ( QPixmap ( ( const char ** ) up_xpm ) );
statusBar() ->addWidget ( dispStatus, 0, true );
StatusMenu = new QPopupMenu ( dispStatus );
dispStatus->setPopup ( StatusMenu );
connect ( StatusMenu, SIGNAL ( aboutToShow() ),
this, SLOT ( statusMenu() ) );
connect ( StatusMenu, SIGNAL ( activated ( int ) ), this, SLOT ( commandCallback ( int ) ) );
toolID = TO_TOOLS;
for ( std::map<QString, toTool *>::iterator k = tools.begin();k != tools.end();k++ ) {
( *k ).second->customSetup ( toolID );
toolID++;
}
Search = NULL;
if ( !toTool::globalConfig ( CONF_MAXIMIZE_MAIN, "Yes" ).isEmpty() )
showMaximized();
show();
QString welcome;
do {
welcome = toCheckLicense ( false );
} while ( welcome.isNull() );
toStatusMessage ( welcome, true );
connect ( &Poll, SIGNAL ( timeout() ), this, SLOT ( checkCaching() ) );
try {
toNewConnection newConnection ( this, "First connection", true );
toConnection *conn;
do {
conn = NULL;
if ( newConnection.exec() ) {
conn = newConnection.makeConnection();
} else {
break;
}
} while ( !conn );
if ( conn )
addConnection ( conn );
}
TOCATCH
connect ( toMainWidget() ->workspace(), SIGNAL ( windowActivated ( QWidget * ) ),
this, SLOT ( windowActivated ( QWidget * ) ) );
}
示例3: CHotKeyEditorMenu
//.........这里部分代码省略.........
actionKillProcessAction = new CAction (tr("Kill Process"), getPixmapIcon("killProcessIcon"),
tr("&Kill Process"), Qt::CTRL + Qt::Key_K, this, "actionKillProcessAction");
actionKillProcessAction->setParentMenuText(tr("Action"));
connect(actionKillProcessAction, SIGNAL(activated()), this, SLOT(killProcesses()));
CAction * actionPingAction = new CAction (tr("Ping"), getPixmapIcon("pingIcon"),
tr("&Ping"), Qt::CTRL + Qt::Key_P, this, "actionPingAction");
actionPingAction->setParentMenuText(tr("Action"));
connect(actionPingAction, SIGNAL(activated()), this, SLOT(ping()));
CAction * actionShutdownAction = new CAction (tr("Shutdown"), getPixmapIcon("serverShutdownIcon"),
tr("&Shutdown"), 0, this, "actionShutdownAction");
actionShutdownAction->setParentMenuText(tr("Action"));
connect(actionShutdownAction, SIGNAL(activated()), this, SLOT(shutdown()));
fileTimerAction = new CAction (tr("Start Refresh Timer"), getPixmapIcon("timerIcon"),
tr("Start Refresh &Timer"), Qt::CTRL + Qt::Key_T, this, "fileTimerAction", true);
fileTimerAction->setParentMenuText(tr("File"));
connect(fileTimerAction, SIGNAL(toggled(bool)), this, SLOT(fileTimerActionToggled(bool)));
QPopupMenu *fileMenu = new QPopupMenu(this);
QPopupMenu *actionMenu = new QPopupMenu(this);
QPopupMenu *viewMenu = new QPopupMenu(this);
connect(viewMenu, SIGNAL(aboutToShow()), this, SLOT(viewMenuAboutToShow()));
fileMenu->insertItem(getPixmapIcon("saveIcon"), tr("Save"), save_menu);
fileMenu->insertSeparator();
fileRefreshAction->addTo(fileMenu);
fileMenu->insertSeparator();
fileTimerAction->addTo(fileMenu);
fileMenu->insertSeparator();
fileCloseAction->addTo(fileMenu);
menuBar()->insertItem(tr("&File"), fileMenu);
viewShowMessagesAction->addTo(viewMenu);
menuBar()->insertItem(tr("&View"), viewMenu);
actionKillProcessAction->addTo(actionMenu);
flush_menu = flushMenu(m_mysql->mysql());
connect(flush_menu, SIGNAL(activated(int)), this, SLOT(flush(int)));
actionMenu->insertItem(getPixmapIcon("flushIcon"),tr("Flush"), flush_menu);
actionPingAction->addTo(actionMenu);
actionMenu->insertSeparator();
actionShutdownAction->addTo(actionMenu);
menuBar()->insertItem(tr("&Action"), actionMenu);
new CHotKeyEditorMenu(this, menuBar(), "HotKeyEditor");
QToolBar * actionToolBar = new QToolBar(tr("Action Bar"), this, Top);
QToolButton * saveTypeButton = new QToolButton(actionToolBar);
saveTypeButton->setPopup(save_menu);
saveTypeButton->setPixmap(getPixmapIcon("saveIcon"));
saveTypeButton->setTextLabel(tr("Save"), true);
saveTypeButton->setPopupDelay(0);
actionToolBar->addSeparator();
actionKillProcessAction->addTo(actionToolBar);
QToolButton * flushTypeButton = new QToolButton(actionToolBar);
flushTypeButton->setPopup(flush_menu);
flushTypeButton->setPixmap(getPixmapIcon("flushIcon"));
flushTypeButton->setTextLabel(tr("Flush"), true);
flushTypeButton->setPopupDelay(0);
actionPingAction->addTo(actionToolBar);
actionToolBar->addSeparator();
actionShutdownAction->addTo(actionToolBar);
QToolBar * refreshToolBar = new QToolBar(tr("Refresh Bar"), this, Top );
fileRefreshAction->addTo(refreshToolBar);
refreshToolBar->addSeparator();
QLabel * delayLabel = new QLabel(refreshToolBar, "delayLabel" );
delayLabel->setMinimumSize(QSize(65, 0));
delayLabel->setText(tr("Refresh Rate (sec)"));
delay = new QSpinBox(refreshToolBar, "delayBox");
delay->setMinimumSize(QSize( 50, 0));
delay->setMaxValue(7200);
delay->setMinValue(1);
CConfig *cfg = new CConfig();
delay->setValue(cfg->readNumberEntry("Refresh Rate", 30));
status->setTraditionalMode(strtobool(cfg->readStringEntry("Status Traditional Mode", "true")));
delete cfg;
status->refresh();
fileTimerAction->addTo(refreshToolBar);
refreshTimer = new QTimer(this);
connect(refreshTimer, SIGNAL(timeout()), this, SLOT(refresh()));
connect(tabWidget, SIGNAL(currentChanged (QWidget *)), this, SLOT(tabChanged(QWidget *)));
myResize(600, 400);
}
示例4: QWidget
OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir,
OFileSelector* sel)
: QWidget( parent ), m_sel( sel ) {
m_all = false;
QVBoxLayout* lay = new QVBoxLayout( this );
m_currentDir = startDir;
/*
* now we add a special bar
* One Button For Up
* Home
* Doc
* And a dropdown menu with FileSystems
* FUTURE: one to change dir with lineedit
* Bookmarks
* Create Dir
*/
QHBox* box = new QHBox(this );
box->setBackgroundMode( PaletteButton );
box->setSpacing( 0 );
QToolButton *btn = new QToolButton( box );
btn->setIconSet( Resource::loadIconSet("up") );
connect(btn, SIGNAL(clicked() ),
this, SLOT( cdUP() ) );
btn = new QToolButton( box );
btn->setIconSet( Resource::loadIconSet("home") );
connect(btn, SIGNAL(clicked() ),
this, SLOT( cdHome() ) );
btn = new QToolButton( box );
btn->setIconSet( Resource::loadIconSet("DocsIcon") );
connect(btn, SIGNAL(clicked() ),
this, SLOT(cdDoc() ) );
m_btnNew = new QToolButton( box );
m_btnNew->setIconSet( Resource::loadIconSet("new") );
connect(m_btnNew, SIGNAL(clicked() ),
this, SLOT(slotNew() ) );
m_btnClose = new QToolButton( box );
m_btnClose->setIconSet( Resource::loadIconSet("close") );
connect(m_btnClose, SIGNAL(clicked() ),
selector(), SIGNAL(closeMe() ) );
btn = new QToolButton( box );
btn->setIconSet( Resource::loadIconSet("pcmcia") );
/* let's fill device parts */
QPopupMenu* pop = new QPopupMenu(this);
connect(pop, SIGNAL( activated(int) ),
this, SLOT(slotFSActivated(int) ) );
StorageInfo storage;
const QList<FileSystem> &fs = storage.fileSystems();
QListIterator<FileSystem> it(fs);
for ( ; it.current(); ++it ) {
const QString disk = (*it)->name();
const QString path = (*it)->path();
m_dev.insert( disk, path );
pop->insertItem( disk );
}
m_fsPop = pop;
btn->setPopup( pop );
lay->addWidget( box );
m_view = new QListView( this );
m_view->installEventFilter(this);
QPEApplication::setStylusOperation( m_view->viewport(),
QPEApplication::RightOnHold);
m_view->addColumn(" " );
m_view->addColumn(tr("Name"), 135 );
m_view->addColumn(tr("Size"), -1 );
m_view->addColumn(tr("Date"), 60 );
m_view->addColumn(tr("Mime Type"), -1 );
m_view->setSorting( 1 );
m_view->setAllColumnsShowFocus( TRUE );
lay->addWidget( m_view, 1000 );
connectSlots();
}