本文整理汇总了C++中setCurrentWidget函数的典型用法代码示例。如果您正苦于以下问题:C++ setCurrentWidget函数的具体用法?C++ setCurrentWidget怎么用?C++ setCurrentWidget使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setCurrentWidget函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setCurrentWidget
void EditWidget::EditTasks()
{
setCurrentWidget(subtaskWidget);
}
示例2: setCurrentWidget
void WalletView::gotoHistoryPage()
{
gui->getHistoryAction()->setChecked(true);
setCurrentWidget(transactionsPage);
}
示例3: setCurrentWidget
void WalletView::gotoNewsPage()
{
gui->getNewsAction()->setChecked(true);
setCurrentWidget(newsPage);
}
示例4: clipboard
void DatabaseTabWidget::lockDatabases()
{
clipboard()->clearCopiedText();
for (int i = 0; i < count(); i++) {
DatabaseWidget* dbWidget = static_cast<DatabaseWidget*>(widget(i));
Database* db = databaseFromDatabaseWidget(dbWidget);
DatabaseWidget::Mode mode = dbWidget->currentMode();
if ((mode != DatabaseWidget::ViewMode && mode != DatabaseWidget::EditMode)
|| !dbWidget->dbHasKey()) {
continue;
}
// show the correct tab widget before we are asking questions about it
setCurrentWidget(dbWidget);
if (mode == DatabaseWidget::EditMode) {
QMessageBox::StandardButton result =
MessageBox::question(
this, tr("Lock database"),
tr("Can't lock the database as you are currently editing it.\nPlease press cancel to finish your changes or discard them."),
QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Cancel);
if (result == QMessageBox::Cancel) {
continue;
}
}
if (m_dbList[db].modified && !m_dbList[db].saveToFilename) {
QMessageBox::StandardButton result =
MessageBox::question(
this, tr("Lock database"),
tr("This database has never been saved.\nYou can save the database or stop locking it."),
QMessageBox::Save | QMessageBox::Cancel, QMessageBox::Cancel);
if (result == QMessageBox::Save) {
if (!saveDatabase(db)) {
continue;
}
}
else if (result == QMessageBox::Cancel) {
continue;
}
}
else if (m_dbList[db].modified) {
QMessageBox::StandardButton result =
MessageBox::question(
this, tr("Lock database"),
tr("This database has been modified.\nDo you want to save the database before locking it?\nOtherwise your changes are lost."),
QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Cancel);
if (result == QMessageBox::Save) {
if (!saveDatabase(db)) {
continue;
}
}
else if (result == QMessageBox::Discard) {
m_dbList[db].modified = false;
}
else if (result == QMessageBox::Cancel) {
continue;
}
}
dbWidget->lock();
// database has changed so we can't use the db variable anymore
updateTabName(dbWidget->database());
}
}
示例5: setCurrentWidget
void CentralWin::setSendPage()
{
setCurrentWidget(sendp);
}
示例6: switch
void PlayQueueView::setMode(ItemView::Mode m)
{
if (m==mode || (ItemView::Mode_GroupedTree!=m && ItemView::Mode_Table!=m)) {
return;
}
if (ItemView::Mode_Table==mode) {
treeView->saveHeader();
}
switch (m) {
case ItemView::Mode_GroupedTree:
if (!groupedView) {
groupedView=new PlayQueueGroupedView(this);
groupedView->setContextMenuPolicy(Qt::ActionsContextMenu);
groupedView->setIndentation(0);
groupedView->setItemsExpandable(false);
groupedView->setExpandsOnDoubleClick(false);
groupedView->installFilter(new KeyEventHandler(groupedView, removeFromAction));
addWidget(groupedView);
connect(groupedView, SIGNAL(itemsSelected(bool)), SIGNAL(itemsSelected(bool)));
connect(groupedView, SIGNAL(doubleClicked(const QModelIndex &)), SIGNAL(doubleClicked(const QModelIndex &)));
updatePalette();
#ifdef Q_OS_MAC
groupedView->setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
groupedView->setProperty(ProxyStyle::constModifyFrameProp, ProxyStyle::VF_Top);
}
break;
case ItemView::Mode_Table:
if (!treeView) {
treeView=new PlayQueueTreeView(this);
treeView->setContextMenuPolicy(Qt::ActionsContextMenu);
treeView->installFilter(new KeyEventHandler(treeView, removeFromAction));
treeView->initHeader();
addWidget(treeView);
connect(treeView, SIGNAL(itemsSelected(bool)), SIGNAL(itemsSelected(bool)));
connect(treeView, SIGNAL(doubleClicked(const QModelIndex &)), SIGNAL(doubleClicked(const QModelIndex &)));
updatePalette();
#ifdef Q_OS_MAC
treeView->setAttribute(Qt::WA_MacShowFocusRect, 0);
#endif
treeView->setProperty(ProxyStyle::constModifyFrameProp, ProxyStyle::VF_Top);
}
default:
break;
}
QAbstractItemModel *model=0;
QList<QAction *> actions;
if (ItemView::Mode_Count!=mode) {
QAbstractItemView *v=view();
model=v->model();
v->setModel(0);
actions=v->actions();
}
mode=m;
QAbstractItemView *v=view();
v->setModel(model);
if (!actions.isEmpty() && v->actions().isEmpty()) {
v->addActions(actions);
}
if (ItemView::Mode_Table==mode) {
treeView->initHeader();
}
setCurrentWidget(static_cast<QWidget *>(view()));
if (spinner) {
spinner->setWidget(view());
if (spinner->isActive()) {
spinner->start();
}
}
if (msgOverlay) {
msgOverlay->setWidget(view());
}
}
示例7: setCurrentWidget
void WalletView::gotoDecisionPage()
{
setCurrentWidget(decisionPage);
}
示例8: setCurrentWidget
void WalletView::gotoBlockBrowser()
{
gui->getBlockAction()->setChecked(true);
setCurrentWidget(blockBrowser);
}
示例9: setCurrentWidget
void WalletView::gotoMiningPage()
{
gui->getMiningAction()->setChecked(true);
setCurrentWidget(miningPage);
}
示例10: setCurrentWidget
void WalletView::gotoReceiveCoinsPage()
{
setCurrentWidget(receiveCoinsPage);
}
示例11: setCurrentWidget
void KNEmptyStateWidget::showEmptyWidget()
{
//Display the empty state widget.
setCurrentWidget(m_emptyWidget);
}
示例12: setCurrentWidget
void WalletView::gotoZerocoinPage()
{
gui->getZerocoinAction()->setChecked(true);
setCurrentWidget(zerocoinPage);
}
示例13: QStackedWidget
//.........这里部分代码省略.........
m_groupView = new GroupView(db, m_splitter);
m_groupView->setObjectName("groupView");
m_groupView->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_groupView, SIGNAL(customContextMenuRequested(QPoint)),
SLOT(emitGroupContextMenuRequested(QPoint)));
m_entryView = new EntryView(rightHandSideWidget);
m_entryView->setObjectName("entryView");
m_entryView->setContextMenuPolicy(Qt::CustomContextMenu);
m_entryView->setGroup(db->rootGroup());
connect(m_entryView, SIGNAL(customContextMenuRequested(QPoint)),
SLOT(emitEntryContextMenuRequested(QPoint)));
QAction* closeAction = new QAction(m_searchWidget);
QIcon closeIcon = filePath()->icon("actions", "dialog-close");
closeAction->setIcon(closeIcon);
m_searchUi->closeSearchButton->setDefaultAction(closeAction);
m_searchUi->closeSearchButton->setShortcut(Qt::Key_Escape);
m_searchWidget->hide();
m_searchUi->caseSensitiveCheckBox->setVisible(false);
QVBoxLayout* vLayout = new QVBoxLayout(rightHandSideWidget);
vLayout->setMargin(0);
vLayout->addWidget(m_searchWidget);
vLayout->addWidget(m_entryView);
rightHandSideWidget->setLayout(vLayout);
setTabOrder(m_searchUi->searchRootRadioButton, m_entryView);
setTabOrder(m_entryView, m_groupView);
setTabOrder(m_groupView, m_searchWidget);
m_splitter->addWidget(m_groupView);
m_splitter->addWidget(rightHandSideWidget);
m_splitter->setStretchFactor(0, 30);
m_splitter->setStretchFactor(1, 70);
layout->addWidget(m_splitter);
m_mainWidget->setLayout(layout);
m_editEntryWidget = new EditEntryWidget();
m_editEntryWidget->setObjectName("editEntryWidget");
m_historyEditEntryWidget = new EditEntryWidget();
m_editGroupWidget = new EditGroupWidget();
m_editGroupWidget->setObjectName("editGroupWidget");
m_changeMasterKeyWidget = new ChangeMasterKeyWidget();
m_changeMasterKeyWidget->headlineLabel()->setText(tr("Change master key"));
QFont headlineLabelFont = m_changeMasterKeyWidget->headlineLabel()->font();
headlineLabelFont.setBold(true);
headlineLabelFont.setPointSize(headlineLabelFont.pointSize() + 2);
m_changeMasterKeyWidget->headlineLabel()->setFont(headlineLabelFont);
m_databaseSettingsWidget = new DatabaseSettingsWidget();
m_databaseSettingsWidget->setObjectName("databaseSettingsWidget");
m_databaseOpenWidget = new DatabaseOpenWidget();
m_databaseOpenWidget->setObjectName("databaseOpenWidget");
m_keepass1OpenWidget = new KeePass1OpenWidget();
m_keepass1OpenWidget->setObjectName("keepass1OpenWidget");
m_unlockDatabaseWidget = new UnlockDatabaseWidget();
m_unlockDatabaseWidget->setObjectName("unlockDatabaseWidget");
addWidget(m_mainWidget);
addWidget(m_editEntryWidget);
addWidget(m_editGroupWidget);
addWidget(m_changeMasterKeyWidget);
addWidget(m_databaseSettingsWidget);
addWidget(m_historyEditEntryWidget);
addWidget(m_databaseOpenWidget);
addWidget(m_keepass1OpenWidget);
addWidget(m_unlockDatabaseWidget);
connect(m_splitter, SIGNAL(splitterMoved(int,int)), SIGNAL(splitterSizesChanged()));
connect(m_entryView->header(), SIGNAL(sectionResized(int,int,int)), SIGNAL(entryColumnSizesChanged()));
connect(m_groupView, SIGNAL(groupChanged(Group*)), this, SLOT(clearLastGroup(Group*)));
connect(m_groupView, SIGNAL(groupChanged(Group*)), SIGNAL(groupChanged()));
connect(m_groupView, SIGNAL(groupChanged(Group*)), m_entryView, SLOT(setGroup(Group*)));
connect(m_entryView, SIGNAL(entryActivated(Entry*, EntryModel::ModelColumn)),
SLOT(entryActivationSignalReceived(Entry*, EntryModel::ModelColumn)));
connect(m_entryView, SIGNAL(entrySelectionChanged()), SIGNAL(entrySelectionChanged()));
connect(m_editEntryWidget, SIGNAL(editFinished(bool)), SLOT(switchToView(bool)));
connect(m_editEntryWidget, SIGNAL(historyEntryActivated(Entry*)), SLOT(switchToHistoryView(Entry*)));
connect(m_historyEditEntryWidget, SIGNAL(editFinished(bool)), SLOT(switchBackToEntryEdit()));
connect(m_editGroupWidget, SIGNAL(editFinished(bool)), SLOT(switchToView(bool)));
connect(m_changeMasterKeyWidget, SIGNAL(editFinished(bool)), SLOT(updateMasterKey(bool)));
connect(m_databaseSettingsWidget, SIGNAL(editFinished(bool)), SLOT(switchToView(bool)));
connect(m_databaseOpenWidget, SIGNAL(editFinished(bool)), SLOT(openDatabase(bool)));
connect(m_keepass1OpenWidget, SIGNAL(editFinished(bool)), SLOT(openDatabase(bool)));
connect(m_unlockDatabaseWidget, SIGNAL(editFinished(bool)), SLOT(unlockDatabase(bool)));
connect(this, SIGNAL(currentChanged(int)), this, SLOT(emitCurrentModeChanged()));
connect(m_searchUi->searchEdit, SIGNAL(textChanged(QString)), this, SLOT(startSearchTimer()));
connect(m_searchUi->caseSensitiveCheckBox, SIGNAL(toggled(bool)), this, SLOT(startSearch()));
connect(m_searchUi->searchCurrentRadioButton, SIGNAL(toggled(bool)), this, SLOT(startSearch()));
connect(m_searchUi->searchRootRadioButton, SIGNAL(toggled(bool)), this, SLOT(startSearch()));
connect(m_searchUi->searchEdit, SIGNAL(returnPressed()), m_entryView, SLOT(setFocus()));
connect(m_searchTimer, SIGNAL(timeout()), this, SLOT(search()));
connect(closeAction, SIGNAL(triggered()), this, SLOT(closeSearch()));
connect( &m_file_watcher, SIGNAL( fileChanged() ), this, SLOT( databaseModifedExternally() ) );
setCurrentWidget(m_mainWidget);
}
示例14: QPoint
bool TabWidget::eventFilter(QObject *obj, QEvent *event)
{
if (obj==tabBar())
{
// this code handles the tab movement
if (event->type() == QEvent::Leave)
{
QPoint point = cross->mapToGlobal( QPoint(0, 0) );
QRect rect(point.x(), point.y(), cross->width(), cross->height() );
if ( !rect.contains( QCursor::pos() ) )
cross->hide();
}
else if (event->type() == QEvent::HoverMove && m_closeButtonInTabs )
{
QHoverEvent *mouseEvent = static_cast<QHoverEvent *>(event);
mousePos = mouseEvent->pos();
for (int i=0; i<tabBar()->count(); i++)
{
if ( tabBar()->tabRect(i).contains( mouseEvent->pos() ) )
{
m_clickedItem= i;
break;
}
}
cross->setGeometry(tabBar()->tabRect(m_clickedItem).x()+tabBar()->tabRect(m_clickedItem).width()-cross->width()-5,
//tabBar()->height()-(tabBar()->tabRect(m_clickedItem).height()/2),
5,
cross->width(),
cross->height());
cross->show();
}
else if (event->type() == QEvent::MouseButtonRelease )
{
qApp->restoreOverrideCursor();
}
else if (event->type() == QEvent::MouseButtonPress )
{
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
for (int i=0; i<tabBar()->count(); i++)
{
if ( tabBar()->tabRect(i).contains( mouseEvent->pos() ) )
{
m_clickedItem = i;
break;
}
}
if ( mouseEvent->button() == Qt::LeftButton )
qApp->setOverrideCursor( Qt::OpenHandCursor );
if ( mouseEvent->button() == Qt::RightButton )
{
QMenu *menu = new QMenu(this);
connect(menu->addAction(QIcon(":/images/cross.png"), tr("Close Tab")), SIGNAL(triggered()), this, SLOT(slotCloseTab()) );
connect(menu->addAction(QIcon(":/images/fileclose.png"), tr("Close Other Tabs")), SIGNAL(triggered()), this, SLOT(slotCloseOtherTab()) );
connect(menu->addAction(QIcon(":/images/fileclose.png"), tr("Close All Tabs")), SIGNAL(triggered()), this, SLOT(slotCloseAllTab()) );
menu->exec(mouseEvent->globalPos());
delete menu;
}
}
else if (event->type() == QEvent::MouseMove )
{
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
for (int i=0; i<tabBar()->count(); i++)
{
if ( tabBar()->tabRect(i).contains( mouseEvent->pos() ) )
{
if ( swapTabs(i, m_clickedItem) )
{
setCurrentWidget(widget(i));
update();
int x;
if ( !tabBar()->tabRect(i).contains( mouseEvent->pos() ) )
{
if ( tabBar()->tabRect(m_clickedItem).x() < tabBar()->tabRect(i).x() )
x = tabBar()->tabRect(i).x();
else
x = tabBar()->tabRect(i).x()+(tabBar()->tabRect(i).width()-(qAbs(tabBar()->tabRect(i).width()-tabBar()->tabRect(m_clickedItem).width())));
QPoint point = QPoint(
x,
mouseEvent->pos().y()
);
point = widget(i)->mapToGlobal( point );
m_clickedItem = i;
QCursor::setPos ( point.x(), QCursor::pos().y() );
}
m_clickedItem = i;
break;
}
}
}
}
}
return QTabWidget::eventFilter( obj, event);
}
示例15: setCurrentWidget
void WalletView::gotoVoteCoinsPage()
{
gui->getVoteCoinsAction()->setChecked(true);
setCurrentWidget(voteCoinsPage);
}