本文整理汇总了C++中QStatusBar类的典型用法代码示例。如果您正苦于以下问题:C++ QStatusBar类的具体用法?C++ QStatusBar怎么用?C++ QStatusBar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QStatusBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例2: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWidget win;
QVBoxLayout* mainLayout = new QVBoxLayout();
// first row
QHBoxLayout* firstRowLayout = new QHBoxLayout();
firstRowLayout->addWidget(new QLabel("Label1", &win), 0);
firstRowLayout->addWidget(new QCheckBox("Flip me", &win), 2);
firstRowLayout->addWidget(new QPushButton("Push me", &win), 1);
mainLayout->addLayout(firstRowLayout, 0);
//
// second row
QHBoxLayout* secondRowLayout = new QHBoxLayout();
secondRowLayout->addWidget(new QLabel("Label2", &win), 0);
secondRowLayout->addWidget(new QTextEdit("Edit me", &win), 1);
mainLayout->addLayout(secondRowLayout, 0);
// button
QPushButton* clickButton = new QPushButton("Click me", &win);
mainLayout->addWidget(clickButton, 0, Qt::AlignCenter);
// status bar
QStatusBar* statusBar = new QStatusBar(&win);
statusBar->showMessage("Status text");
mainLayout->addWidget(statusBar, 0);
win.setLayout(mainLayout);
win.show();
return a.exec();
}
示例3: QObject
StatusBarManager::StatusBarManager(MainWindow *mainWnd)
: QObject(mainWnd),
m_mainWnd(mainWnd)
{
QStatusBar *bar = m_mainWnd->statusBar();
m_splitter = new NonResizingSplitter(bar);
bar->insertPermanentWidget(0, m_splitter, 10);
m_splitter->setChildrenCollapsible(false);
// first
QWidget *w = createWidget(m_splitter);
w->layout()->setContentsMargins(0, 0, 3, 0);
m_splitter->addWidget(w);
m_statusBarWidgets.append(w);
QWidget *w2 = createWidget(m_splitter);
w2->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
m_splitter->addWidget(w2);
// second
w = createWidget(w2);
w2->layout()->addWidget(w);
m_statusBarWidgets.append(w);
// third
w = createWidget(w2);
w2->layout()->addWidget(w);
m_statusBarWidgets.append(w);
static_cast<QBoxLayout *>(w2->layout())->addStretch(1);
QWidget *rightCornerWidget = createWidget(bar);
bar->insertPermanentWidget(1, rightCornerWidget);
m_statusBarWidgets.append(rightCornerWidget);
}
示例4: QMainWindow
MobileVis1MainWindow::MobileVis1MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MobileVis1MainWindow)
{
ui->setupUi(this);
#ifdef Q_WS_MAEMO_5
setAttribute(Qt::WA_Maemo5StackedWindow);
#endif
#if defined (Q_WS_X11) && !defined (Q_WS_MAEMO5)
qDebug() << "Q_WS_X11";
//http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
//http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
ui->ReplayStopButton->setIcon( QIcon::fromTheme ("media-playback-start") );
ui->ReplayPauseButton->setIcon( QIcon::fromTheme ("media-playback-pause") );
ui->ReplayStopButton->setIcon( QIcon::fromTheme ("media-playback-stop") );
ui->DVMicroLeftButton->setIcon( QIcon::fromTheme("media-seek-backward") );
ui->DVLeftButton->setIcon( QIcon::fromTheme("media-skip-backward") );
#endif
QStatusBar* sb = statusBar();
if ( sb )
sb->hide();
// grabGesture(Qt::PanGesture);
// grabGesture(Qt::PinchGesture);
// grabGesture(Qt::SwipeGesture);
// swipeGesture = new N900SwipeGesture(this);
// connect(swipeGesture,SIGNAL(handleSwipe(N900SwipeGesture::SwipeDirection)),
// this,SLOT(swipe(N900SwipeGesture::SwipeDirection)));
}
示例5: removeWidget
int StatusBar::removeWidget(lua_State * L) // ( QWidget * widget )
{
QStatusBar* obj = ObjectHelper<QStatusBar>::check( L, 1);
QWidget* widget = ObjectHelper<QWidget>::check( L, 2);
obj->removeWidget( widget ) ;
return 0;
}
示例6: QgsVertexMarker
void QgsMapToolCapture::addError( QgsGeometry::Error e )
{
mGeomErrors << e;
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( mCanvas->currentLayer() );
if ( !vlayer )
return;
if ( !mTip.isEmpty() )
mTip += "\n";
mTip += e.what();
if ( e.hasWhere() )
{
QgsVertexMarker *vm = new QgsVertexMarker( mCanvas );
vm->setCenter( mCanvas->mapSettings().layerToMapCoordinates( vlayer, e.where() ) );
vm->setIconType( QgsVertexMarker::ICON_X );
vm->setPenWidth( 2 );
vm->setToolTip( e.what() );
vm->setColor( Qt::green );
vm->setZValue( vm->zValue() + 1 );
mGeomErrorMarkers << vm;
}
QStatusBar *sb = QgisApp::instance()->statusBar();
sb->showMessage( e.what() );
if ( !mTip.isEmpty() )
sb->setToolTip( mTip );
}
示例7: while
void QgsSelectedFeature::validateGeometry( QgsGeometry *g )
{
QSettings settings;
if ( settings.value( "/qgis/digitizing/validate_geometries", 1 ).toInt() == 0 )
return;
if ( !g )
g = mGeometry;
mTip.clear();
if ( mValidator )
{
mValidator->stop();
mValidator->wait();
mValidator->deleteLater();
mValidator = 0;
}
mGeomErrors.clear();
while ( !mGeomErrorMarkers.isEmpty() )
{
QgsVertexMarker *vm = mGeomErrorMarkers.takeFirst();
QgsDebugMsg( "deleting " + vm->toolTip() );
delete vm;
}
mValidator = new QgsGeometryValidator( g );
connect( mValidator, SIGNAL( errorFound( QgsGeometry::Error ) ), this, SLOT( addError( QgsGeometry::Error ) ) );
connect( mValidator, SIGNAL( finished() ), this, SLOT( validationFinished() ) );
mValidator->start();
QStatusBar *sb = QgisApp::instance()->statusBar();
sb->showMessage( tr( "Validation started." ) );
}
示例8: QStatusBar
//! Methode zum Setzen / Füllen der Statusleiste
void MainWindow::setStatusBar()
{
QStatusBar* statusBar = new QStatusBar();
statusBar->addWidget(new QLabel(tr("Gebiete: ") + QString::number(_DB->allArea()->count()) \
+ tr(" | Bewohner: ") + QString::number(_DB->allHabitant()->count())));
QMainWindow::setStatusBar(statusBar);
}
示例9: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent)
{
QMenuBar *menuBar;
QToolBar *mainToolBar;
QWidget *centralWidget;
QStatusBar *statusBar;
if (this->objectName().isEmpty())
this->setObjectName(QString::fromUtf8("MainWindow"));
this->resize(400, 300);
menuBar = new QMenuBar(this);
menuBar->setObjectName(QString::fromUtf8("menuBar"));
this->setMenuBar(menuBar);
mainToolBar = new QToolBar(this);
mainToolBar->setObjectName(QString::fromUtf8("mainToolBar"));
this->addToolBar(mainToolBar);
centralWidget = new QWidget(this);
centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
this->setCentralWidget(centralWidget);
statusBar = new QStatusBar(this);
statusBar->setObjectName(QString::fromUtf8("statusBar"));
this->setStatusBar(statusBar);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
this->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0));
#else
this->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0, QApplication::UnicodeUTF8));
#endif
QMetaObject::connectSlotsByName(this);
}
示例10: QMainWindow
MainWindow::MainWindow()
: QMainWindow(NULL, "mainwnd",
WType_TopLevel | WStyle_Customize |
WStyle_Title | WStyle_NormalBorder| WStyle_SysMenu),
EventReceiver(LowestPriority)
{
m_grip = NULL;
h_lay = NULL;
m_bNoResize = false;
SET_WNDPROC("mainwnd");
m_icon = "ICQ";
setIcon(Pict(m_icon.c_str()));
setTitle();
#ifdef WIN32
pMain = this;
if (IsWindowUnicode(winId())){
oldProc = (WNDPROC)SetWindowLongW(winId(), GWL_WNDPROC, (LONG)wndProc);
}else{
oldProc = (WNDPROC)SetWindowLongA(winId(), GWL_WNDPROC, (LONG)wndProc);
}
#endif
bar = NULL;
main = new MainWindowWidget(this);
setCentralWidget(main);
lay = new QVBoxLayout(main);
QStatusBar *status = statusBar();
status->hide();
status->installEventFilter(this);
}
示例11: QmitkFileOpenAction
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);
}
示例12: currentMessage
int StatusBar::currentMessage(lua_State * L) // const : QString
{
QStatusBar* obj = ObjectHelper<QStatusBar>::check( L, 1);
//QString* res = ValueInstaller2<QString>::create( L );
//*res = obj->currentMessage();
Util::push( L, obj->currentMessage() );
return 1;
}
示例13: QLabel
void CallWindow::initFooter()
{
leftFooter = new QLabel();
rightFooter = new QLabel();
QStatusBar *bar = statusBar();
bar->addPermanentWidget(leftFooter, 2);
bar->addPermanentWidget(rightFooter, 2);
}
示例14: menuBar
void MainWindow::toggledFullScreen(bool val) {
QMenuBar* pMenuBar = menuBar();
if ( pMenuBar )
pMenuBar->setVisible(!val);
QStatusBar *pStatusBar = statusBar();
if ( pStatusBar )
pStatusBar->setVisible(!val);
}
示例15: NewKey
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;
}