本文整理汇总了C++中QStatusBar::addPermanentWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ QStatusBar::addPermanentWidget方法的具体用法?C++ QStatusBar::addPermanentWidget怎么用?C++ QStatusBar::addPermanentWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStatusBar
的用法示例。
在下文中一共展示了QStatusBar::addPermanentWidget方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QComboBox
void
App::loadStatusBar()
{
//TODO maybe not use a statusbar for this
QStatusBar *statusBar = _mainwindow->statusBar();
QStringList players{"Human", "Random", "NegaMax", "NegaMaxWTt", "MTD-f"};
_whiteCombo = new QComboBox();
statusBar->addPermanentWidget(_whiteCombo);
_whiteCombo->addItems(players);
_whiteCombo->setCurrentIndex(4);
connect(_whiteCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setWhitePlayer(int)));
statusBar->addPermanentWidget(new QLabel("White"));
statusBar->showMessage("Test");
statusBar->addPermanentWidget(new QLabel("Black"));
_blackCombo = new QComboBox();
statusBar->addPermanentWidget(_blackCombo);
_blackCombo->addItems(players);
_blackCombo->setCurrentIndex(4);
connect(_blackCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setBlackPlayer(int)));
}
示例2: QMainWindow
/**
* @brief 构造函数
* @param [I] 平台指针
* @param [I] 父指针
* @param [I] 窗口标志
*/
MainWindow::MainWindow(Workbench *wb, QWidget *parent, Qt::WFlags flags)
: QMainWindow(parent, flags)
, ui(new Ui::MainWindowClass)
, m_workbench(wb)
{
ui->setupUi(this);
m_messageWidget = MessageWidget::instance();
m_messageWidget->setParent(this, Qt::Tool);
QStatusBar *statusBar = this->statusBar();
{
QToolButton *button = new QToolButton(statusBar);
button->setIcon(QApplication::style()->standardIcon(QStyle::SP_FileDialogDetailedView));
button->setAutoRaise(true);
connect(button, SIGNAL(clicked()), workbench(), SLOT(showDebugger()));
statusBar->addPermanentWidget(button);
}
// 显示消息按钮
{
QToolButton *button = new QToolButton(statusBar);
button->addAction(m_messageWidget->toggleAction());
button->setDefaultAction(m_messageWidget->toggleAction());
button->setAutoRaise(true);
statusBar->addPermanentWidget(button);
}
}
示例3: PostWindowCreate
void QmitkWorkbenchWindowAdvisor::PostWindowCreate()
{
// very bad hack...
berry::IWorkbenchWindow::Pointer window = this->GetWindowConfigurer()->GetWindow();
QMainWindow* mainWindow = static_cast<QMainWindow*>(window->GetShell()->GetControl());
QMenuBar* menuBar = mainWindow->menuBar();
QMenu* fileMenu = menuBar->addMenu("&File");
fileMenu->addAction(new QmitkFileOpenAction(window));
fileMenu->addSeparator();
fileMenu->addAction(new QmitkFileExitAction(window));
berry::IViewRegistry* viewRegistry = berry::PlatformUI::GetWorkbench()->GetViewRegistry();
const std::vector<berry::IViewDescriptor::Pointer>& viewDescriptors = viewRegistry->GetViews();
QMenu* viewMenu = menuBar->addMenu("Show &View");
// sort elements (converting vector to map...)
std::vector<berry::IViewDescriptor::Pointer>::const_iterator iter;
std::map<std::string, berry::IViewDescriptor::Pointer> VDMap;
for (iter = viewDescriptors.begin(); iter != viewDescriptors.end(); ++iter)
{
if ((*iter)->GetId() == "org.blueberry.ui.internal.introview")
continue;
std::pair<std::string, berry::IViewDescriptor::Pointer> p((*iter)->GetLabel(), (*iter));
VDMap.insert(p);
}
QToolBar* qToolbar = new QToolBar;
std::map<std::string, berry::IViewDescriptor::Pointer>::const_iterator MapIter;
for (MapIter = VDMap.begin(); MapIter != VDMap.end(); ++MapIter)
{
berry::QtShowViewAction* viewAction = new berry::QtShowViewAction(window, (*MapIter).second);
//m_ViewActions.push_back(viewAction);
viewMenu->addAction(viewAction);
qToolbar->addAction(viewAction);
}
mainWindow->addToolBar(qToolbar);
QStatusBar* qStatusBar = new QStatusBar();
//creating a QmitkStatusBar for Output on the QStatusBar and connecting it with the MainStatusBar
QmitkStatusBar *statusBar = new QmitkStatusBar(qStatusBar);
//disabling the SizeGrip in the lower right corner
statusBar->SetSizeGripEnabled(false);
QmitkProgressBar *progBar = new QmitkProgressBar();
qStatusBar->addPermanentWidget(progBar, 0);
progBar->hide();
mainWindow->setStatusBar(qStatusBar);
QmitkMemoryUsageIndicatorView* memoryIndicator = new QmitkMemoryUsageIndicatorView();
qStatusBar->addPermanentWidget(memoryIndicator, 0);
}
示例4: initFooter
void CallWindow::initFooter()
{
leftFooter = new QLabel();
rightFooter = new QLabel();
QStatusBar *bar = statusBar();
bar->addPermanentWidget(leftFooter, 2);
bar->addPermanentWidget(rightFooter, 2);
}
示例5: newItem
void db_key::newItem(QString name)
{
NewKey *dlg = new NewKey(qApp->activeWindow(), name);
QProgressBar *bar;
QStatusBar *status = mainwin->statusBar();
pki_evp *nkey = NULL;
pki_scard *cardkey = NULL;
pki_key *key = NULL;
if (!dlg->exec()) {
delete dlg;
return;
}
int ksize = dlg->getKeysize();
if (ksize > 0) {
if (ksize < 32) {
QMessageBox::warning(NULL, XCA_TITLE,
tr("Key size too small !"));
delete dlg;
return;
}
if (ksize < 1024 || ksize > 8192)
if (QMessageBox::warning(NULL, XCA_TITLE,
tr("You are sure to create a key of the size: %1 ?").arg(ksize),
QMessageBox::Yes | QMessageBox::No) !=
QMessageBox::Yes)
{
delete dlg;
return;
}
}
mainwin->repaint();
bar = new QProgressBar();
status->addPermanentWidget(bar, 1);
try {
if (dlg->isToken()) {
key = cardkey = new pki_scard(dlg->keyDesc->text());
cardkey->generateKey_card(dlg->getKeyCardSlot(),
ksize, bar);
} else {
key = nkey = new pki_evp(dlg->keyDesc->text());
nkey->generate(ksize, dlg->getKeytype(), bar,
dlg->getKeyCurve_nid());
}
key = (pki_key*)insert(key);
emit keyDone(key->getIntNameWithType());
createSuccess(key);
} catch (errorEx &err) {
delete key;
mainwin->Error(err);
}
status->removeWidget(bar);
delete bar;
delete dlg;
}
示例6: addPermanentWidget
int StatusBar::addPermanentWidget(lua_State * L) // ( QWidget * widget, int stretch = 0 )
{
QStatusBar* obj = ObjectHelper<QStatusBar>::check( L, 1);
QWidget* widget = ObjectHelper<QWidget>::check( L, 2);
int stretch = 0;
if (Util::isNum( L, 3 ) )
{
if ( Util::toInt( L, 3 ) < 0 )
{
Util::error( L, "Starting No can not be negative" );
}
else
{
stretch = Util::toInt( L, 3 );
}
}
obj->addPermanentWidget( widget, stretch ) ;
return 0;
}
示例7: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
setWindowFlags(Qt::WindowCloseButtonHint);
ui->setupUi(this);
QStatusBar *statusBar = this->statusBar();
QLabel *mode = new QLabel( tr(" Time ") );
mode->setMinimumSize( mode->sizeHint() );
mode->setAlignment( Qt::AlignCenter );
mode->setText( tr("Ready") );
mode->setToolTip( tr("The current working mode.") );
statusBar->addPermanentWidget( mode );
connect(ui->tableWidget_resultat,SIGNAL(clicked(QModelIndex)),this,SLOT(modifierPatient(QModelIndex)));
connect(ui->lineEdit_search,SIGNAL(editingFinished()),this,SLOT(on_btn_search_clicked()));
this->setWidget();
this->afficherRess();
this->on_btn_search_clicked();
statusBar->showMessage( tr("Ready!!"));
}
示例8: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
// "([^"]+)"|(\S+)
// ""([^""]+)""|(\\S+)
//WavSound *w = new WavSound(":/resources/connected.wav", 0);
//w->play();
//return;
//PlaySound();
//return;
ui->setupUi(this);
QApplication::setWindowIcon(QIcon(":/resources/Icon/RunningIcon.png"));
strangerPrefsWindow = new StrangerPrefsWindow(this);
//QDockWidget *drawdock = new QDockWidget(this,Qt::Dialog);
//this->addDockWidget(Qt::RightDockWidgetArea,drawdock);
/*CometClient *c = new CometClient(this);
c->get("http://gggoogle.ru", 6);
c->get("http://gggoogle.ru", 7);
c->get("http://google.ru", 8);
c->get("http://googleq.ru", 9);
c->cancelAllRequests();
return;
*/
/*QHBoxLayout *dockLayout = new QHBoxLayout(this);
QComboBox *b = new QComboBox(this);
QTextEdit *t = new QTextEdit(this);
dockLayout->addWidget(b);
dockLayout->addWidget(t);
dockLayout->setSizeConstraint(QLayout::SetMinimumSize);
ui->dockWidgetContents_2->setLayout(dockLayout);
*/
QWidget::setTabOrder(ui->typingBox, ui->chatlogBox);
//do not allow Qt framework to intercept Tab keypress (we use it for switching modes)
//ui->chatlogBox->setFocusPolicy(Qt::NoFocus);
/*QFile stylesheetFile(":/resources/stylesheet.qss");
if(!stylesheetFile.open(QFile::ReadOnly)) {
qDebug() << "Error opening file " << stylesheetFile.error();
}
QString stylesheetString = QLatin1String(stylesheetFile.readAll());
setStyleSheet(stylesheetString);
*/
nightColoringMode = false;
switchColoringMode(); //switch to night coloring mode, and apply it
QStatusBar *sb = this->statusBar();
chatModeLabel = new QLabel(this);
//chatModeLabel = new QPushButton(this);
//chatModeLabel->setFlat(true);
sb->addPermanentWidget(chatModeLabel);
typingLabel = new QLabel(this);
sb->addPermanentWidget(typingLabel);
//center the window
setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, size(), qApp->desktop()->availableGeometry()));
receivedMessageSound = NULL;
sentMessageSound = NULL;
connectedSound = NULL;
disconnectedSound = NULL;
receivedMessageSound = new QSound(":/resources/sounds/shuffle.wav", this);
//sentMessageSound = new QSound(":/resources/sounds/test.wav", this);
connectedSound = new QSound(":/resources/sounds/click1.wav", this);
disconnectedSound = new QSound(":/resources/sounds/phone_disc.wav", this);
//receivedMessageSound->setObjectName();
//return;
QObject::connect(ui->typingBox, SIGNAL(enterPressed()), this, SLOT(enterPressed()));
QObject::connect(ui->typingBox, SIGNAL(escapePressed()), this, SLOT(escapePressed()));
QObject::connect(ui->typingBox, SIGNAL(switchMode()), this, SLOT(SwitchMode()));
QObject::connect(ui->typingBox, SIGNAL(typingStarted()), this, SLOT(TypingStarted()));
QObject::connect(ui->typingBox, SIGNAL(typingStopped()), this, SLOT(TypingStopped()));
QObject::connect(ui->typingBox, SIGNAL(showPreferences()), this, SLOT(displayStrangerPreferencesWindow()));
QObject::connect(ui->typingBox, SIGNAL(switchColoringMode()), this, SLOT(switchColoringMode()));
//.........这里部分代码省略.........
示例9: QMainWindow
//.........这里部分代码省略.........
connect(action, SIGNAL(triggered()), this, SIGNAL(activateSearch()));
addAction(action);
action = new QAction(this);
action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_B));
connect(action, SIGNAL(triggered()), this, SIGNAL(activateBookmarks()));
addAction(action);
action = new QAction(this);
action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_O));
connect(action, SIGNAL(triggered()), this, SIGNAL(activateOpenPages()));
addAction(action);
CentralWidget *centralWidget = CentralWidget::instance();
action = new QAction(this);
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Plus));
connect(action, SIGNAL(triggered()), centralWidget, SLOT(zoomIn()));
addAction(action);
action = new QAction(this);
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Minus));
connect(action, SIGNAL(triggered()), centralWidget, SLOT(zoomOut()));
addAction(action);
action = new QAction(this);
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M));
connect(action, SIGNAL(triggered()), this, SIGNAL(addBookmark()));
addAction(action);
action = new QAction(this);
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
connect(action, SIGNAL(triggered()), centralWidget, SLOT(copy()));
addAction(action);
action = new QAction(this);
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_P));
connect(action, SIGNAL(triggered()), centralWidget, SLOT(print()));
addAction(action);
action = new QAction(this);
action->setShortcut(QKeySequence::Back);
action->setEnabled(centralWidget->isBackwardAvailable());
connect(action, SIGNAL(triggered()), centralWidget, SLOT(backward()));
connect(centralWidget, SIGNAL(backwardAvailable(bool)), action,
SLOT(setEnabled(bool)));
action = new QAction(this);
action->setShortcut(QKeySequence::Forward);
action->setEnabled(centralWidget->isForwardAvailable());
connect(action, SIGNAL(triggered()), centralWidget, SLOT(forward()));
connect(centralWidget, SIGNAL(forwardAvailable(bool)), action,
SLOT(setEnabled(bool)));
QAction *reset = new QAction(this);
connect(reset, SIGNAL(triggered()), centralWidget, SLOT(resetZoom()));
addAction(reset);
QAction *ctrlTab = new QAction(this);
connect(ctrlTab, SIGNAL(triggered()), &OpenPagesManager::instance(),
SLOT(gotoPreviousPage()));
addAction(ctrlTab);
QAction *ctrlShiftTab = new QAction(this);
connect(ctrlShiftTab, SIGNAL(triggered()), &OpenPagesManager::instance(),
SLOT(gotoNextPage()));
addAction(ctrlShiftTab);
action = new QAction(QIcon(QLatin1String(Core::Constants::ICON_TOGGLE_SIDEBAR)),
tr("Show Sidebar"), this);
connect(action, SIGNAL(triggered()), this, SIGNAL(showHideSidebar()));
if (Utils::HostOsInfo::isMacHost()) {
reset->setShortcut(QKeySequence(Qt::ALT + Qt::Key_0));
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_0));
ctrlTab->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Tab));
ctrlShiftTab->setShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + Qt::Key_Tab));
} else {
reset->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_0));
action->setShortcut(QKeySequence(Qt::ALT + Qt::Key_0));
ctrlTab->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Tab));
ctrlShiftTab->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Tab));
}
QToolButton *button = new QToolButton;
button->setDefaultAction(action);
QStatusBar *statusbar = statusBar();
statusbar->show();
statusbar->setProperty("p_styled", true);
statusbar->addPermanentWidget(button);
QWidget *w = new QWidget;
QHBoxLayout *layout = new QHBoxLayout(w);
layout->addStretch(1);
statusbar->insertWidget(1, w, 1);
installEventFilter(this);
setWindowTitle(tr("Qt Creator Offline Help"));
}
示例10: mMain
MainWindow::MainWindow(Main * main) :
mMain(main)
{
setCorner( Qt::BottomLeftCorner, Qt::LeftDockWidgetArea );
// Construct status bar:
mLangStatus = new StatusLabel();
mLangStatus->setText("Inactive");
mSynthStatus = new StatusLabel();
mSynthStatus->setText("Inactive");
QStatusBar *status = statusBar();
status->addPermanentWidget( new QLabel("Interpreter:") );
status->addPermanentWidget( mLangStatus );
status->addPermanentWidget( new QLabel("Synth:") );
status->addPermanentWidget( mSynthStatus );
// Code editor
mEditors = new MultiEditor(main);
// Docks
mDocListDock = new DocumentsDock(main->documentManager(), this);
mPostDock = new PostDock(this);
// Layout
// use a layout for tool widgets, to provide for separate margin control
QVBoxLayout *tool_box = new QVBoxLayout;
tool_box->addWidget(cmdLine());
tool_box->setContentsMargins(5,2,5,2);
QVBoxLayout *center_box = new QVBoxLayout;
center_box->setContentsMargins(0,0,0,0);
center_box->setSpacing(0);
center_box->addWidget(mEditors);
center_box->addLayout(tool_box);
QWidget *central = new QWidget;
central->setLayout(center_box);
setCentralWidget(central);
addDockWidget(Qt::LeftDockWidgetArea, mDocListDock);
addDockWidget(Qt::BottomDockWidgetArea, mPostDock);
// A system for easy evaluation of pre-defined code:
connect(&mCodeEvalMapper, SIGNAL(mapped(QString)),
this, SIGNAL(evaluateCode(QString)));
connect(this, SIGNAL(evaluateCode(QString,bool)),
main->scProcess(), SLOT(evaluateCode(QString,bool)));
// Interpreter: post output
connect(main->scProcess(), SIGNAL( scPost(QString) ),
mPostDock->mPostWindow, SLOT( post(QString) ) );
// Interpreter: monitor running state
connect(main->scProcess(), SIGNAL( stateChanged(QProcess::ProcessState) ),
this, SLOT( onInterpreterStateChanged(QProcess::ProcessState) ) );
// Interpreter: forward status messages
connect(main->scProcess(), SIGNAL(statusMessage(const QString&)),
status, SLOT(showMessage(const QString&)));
// Document list interaction
connect(mDocListDock->list(), SIGNAL(clicked(Document*)),
mEditors, SLOT(setCurrent(Document*)));
connect(mEditors, SIGNAL(currentChanged(Document*)),
mDocListDock->list(), SLOT(setCurrent(Document*)),
Qt::QueuedConnection);
createMenus();
QIcon icon;
icon.addFile(":/icons/sc-cube-128");
icon.addFile(":/icons/sc-cube-48");
icon.addFile(":/icons/sc-cube-32");
icon.addFile(":/icons/sc-cube-16");
QApplication::setWindowIcon(icon);
}
示例11: dir
HPicSync::HPicSync(QWidget *parent)
: QMainWindow(parent), ui(new Ui::HPicSync),mOptionWidget(NULL),mThreadManager(this),mDirManager(mThreadManager,mDatabaseHandler,mOption),
mThumbManager(mDatabaseHandler, mOption),mMoreThanOneSelected(false)
{
ui->setupUi(this);
ui->listWidgetNew->setItemDelegate(new HPSListViewDelegate(mOption.getThumbSize(),&mMoreThanOneSelected,this));
ui->listWidgetOld->setItemDelegate(new HPSOldListDelegate(mOption.getThumbSize(),this));
mDirManager.setModel( ui->comboBox->standardModel());
initCBOrdner(mOption.getComboBoxView(),mOption.getComboBoxCurrentDir());
QStatusBar *bar = ui->statusbar;
mConnectLabel = new QLabel(tr("nicht verbunden"));
mConnectPixGruenLabel = new QLabel();
mConnectPixGruenLabel->setPixmap(QPixmap(":/knopfGruen").scaled(QSize(17,17),Qt::KeepAspectRatio));
mConnectPixRotLabel = new QLabel();
mConnectPixRotLabel->setPixmap(QPixmap(":/knopfRot").scaled(QSize(17,17),Qt::KeepAspectRatio));
mBar = new HPSProgressBar;
// this->mPixOldLoadCountLabel = new QLabel("");
//this->mPixOldLoadCountLabel->setVisible(false);
mBar->setVisible(false);
mBar->setValue(0);
mBar->setTextVisible(false);
bar->addWidget(this->mConnectPixGruenLabel);
bar->addWidget(this->mConnectPixRotLabel);
bar->addWidget(this->mConnectLabel);
bar->addPermanentWidget( mBar);
ui->progressBar->hide();
/*
this->connect(this->mCloseButton,SIGNAL(clicked()),this,SLOT(close()));
this->connect(this->mOptionButton,SIGNAL(clicked()),this,SLOT(showOption()));
this->connect(this->mRefreshButton,SIGNAL(clicked()),this,SLOT(test()));
this->connect(this->mCopyButton,SIGNAL(clicked()),this,SLOT(test2()));
connect(mPlusButton,SIGNAL(clicked()),this,SLOT(clickedPlus()));
connect( &mThumbManager,SIGNAL(thumbsReady(int)),this,SLOT(refreshBar(int)));
connect( &mThumbManager,SIGNAL(startThumbCreation(QString,int)),this,SLOT(initBar(QString,int)));
connect( &mThumbManager,SIGNAL(dirCreationReady(QString)),&mDirManager,SLOT(finishAddDir(QString)));
//connect( &mThumbManager,SIGNAL(startCreation()),this,SLOT(startBar()));
connect( &mThumbManager,SIGNAL(creationReady()),this,SLOT(finishBar()));
connect( mMinusButton,SIGNAL(clicked()),this,SLOT(clickedMinus()));
*/
connect( ui->comboBox,SIGNAL(dirChanged(QString)),this,SLOT(comboBoxDirClicked(QString)));
setGeometry(mOption.getGeometry());
if(!mDatabaseHandler.openDatabase("picsync.db"))
QMessageBox::critical(this, trUtf8("Fehler"), trUtf8("Verbindeung mit der Datenbank konnte nicht hergestellt werden."),QMessageBox::Ok);
QDir dir( QApplication::applicationDirPath());
if(!dir.exists(".thumbs")){
dir.mkdir(".thumbs");
}
initThumbManager();
qDebug() << Q_FUNC_INFO << mOption.dirFromDirlister();
if(!mOption.dirFromDirlister().isEmpty()){
mDirManager.startAddDir(mOption.dirFromDirlister(),true);
}
mThreadManager.initDirWatcher(mOption,mDirManager,mDatabaseHandler);
HPSDirWatcher *dirWatcher = mThreadManager.dirWatcher();
connect(this,SIGNAL(startFirstRun()),dirWatcher,SLOT(startFirstRun()));
emit startFirstRun();
}