当前位置: 首页>>代码示例>>C++>>正文


C++ QToolBar::setVisible方法代码示例

本文整理汇总了C++中QToolBar::setVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ QToolBar::setVisible方法的具体用法?C++ QToolBar::setVisible怎么用?C++ QToolBar::setVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QToolBar的用法示例。


在下文中一共展示了QToolBar::setVisible方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QToolBar

void tst_QToolBar::task197996_visibility()
{
    QMainWindow mw;
    QToolBar *toolBar = new QToolBar(&mw);

    mw.addToolBar(toolBar);
    toolBar->addAction(new QAction("Foo", &mw));
    QAction *pAction = new QAction("Test", &mw);
    toolBar->addAction(pAction);

    pAction->setVisible(false);
    toolBar->setVisible(false);

    toolBar->setVisible(true);
    pAction->setVisible(true);

    mw.show();

    QVERIFY(toolBar->widgetForAction(pAction)->isVisible());

    toolBar->setVisible(false);
    pAction->setVisible(false);

    toolBar->setVisible(true);
    pAction->setVisible(true);

    QTest::qWait(100);

    QVERIFY(toolBar->widgetForAction(pAction)->isVisible());

}
开发者ID:PNIDigitalMedia,项目名称:emscripten-qt,代码行数:31,代码来源:tst_qtoolbar.cpp

示例2: createToolBar

static QToolBar* createToolBar(const QString& name, QWidget* parent, bool visible) {
    QToolBar* bar = new QToolBar(parent);
    bar->setObjectName(name);
    bar->setFloatable(false);
    bar->setMovable(true);
    bar->setVisible(visible);
    return bar;
}
开发者ID:greg-hellings,项目名称:bibletime,代码行数:8,代码来源:bibletime_init.cpp

示例3: addEditor

void EditorView::addEditor(IEditor *editor)
{
    if (m_editors.contains(editor))
        return;

    m_editors.append(editor);

    m_container->addWidget(editor->widget());
    m_widgetEditorMap.insert(editor->widget(), editor);

    QToolBar *toolBar = editor->toolBar();
    if (toolBar) {
        toolBar->setVisible(false); // will be made visible in setCurrentEditor
        m_toolBar->layout()->addWidget(toolBar);
    }
    connect(editor, SIGNAL(changed()), this, SLOT(checkEditorStatus()));

    if (editor == currentEditor())
        setCurrentEditor(editor);
}
开发者ID:choenig,项目名称:qt-creator,代码行数:20,代码来源:editorview.cpp

示例4: QMainWindow

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    pSettings_(NULL),
    redValue_(0),
    greenValue_(0),
    blueValue_(0),
    pRedLabel_(NULL),
    pGreenLabel_(NULL),
    pBlueLabel_(NULL),
    pRedValueLabel_(NULL),
    pGreenValueLabel_(NULL),
    pBlueValueLabel_(NULL),
    pRedSlider_(NULL),
    pGreenSlider_(NULL),
    pBlueSlider_(NULL)
{
    ui->setupUi(this);

    QString settingsFilePath = QDir::homePath() + "/.colorsrc";
    pSettings_ = new QSettings(settingsFilePath, QSettings::NativeFormat, this);

    redValue_ = static_cast<uint8_t>(pSettings_->value(redValueKey).toInt());
    greenValue_ = static_cast<uint8_t>(pSettings_->value(greenValueKey).toInt());
    blueValue_ = static_cast<uint8_t>(pSettings_->value(blueValueKey).toInt());

    // hides all main window normal GUI related stuff
    QObjectList childObjects = children();
    foreach (QObject* pChildObject, childObjects) {
        QToolBar* pToolBar = qobject_cast<QToolBar*>(pChildObject);
        if (pToolBar)
            pToolBar->setVisible(false);

        QStatusBar* pStatusBar = qobject_cast<QStatusBar*>(pChildObject);
        if (pStatusBar)
            pStatusBar->setVisible(false);

        QMenuBar* pMenuBar = qobject_cast<QMenuBar*>(pChildObject);
        if (pMenuBar)
            pMenuBar->setVisible(false);
    }
开发者ID:matusz,项目名称:colors,代码行数:41,代码来源:mainwindow.cpp

示例5: createToolBars

void MainWindow::createToolBars()
{
	m_tabBar = new QTabBar();
	m_tabBar->setDocumentMode(true);
	m_tabBar->setTabsClosable(true);
	m_tabBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);

	#ifdef Q_OS_MAC
	m_tabBar->setDrawBase(false);
	#endif

	connect(m_tabBar, SIGNAL(currentChanged(int)),
		this, SLOT(onTabChanged(int)));
	connect(m_tabBar, SIGNAL(tabCloseRequested(int)),
		this, SLOT(onTabCloseRequested(int)));

	QToolBar* toolBar = new QToolBar(tr("Game Tabs"));
	toolBar->setVisible(false);
	toolBar->setFloatable(false);
	toolBar->setMovable(false);
	toolBar->setAllowedAreas(Qt::TopToolBarArea);
	toolBar->addWidget(m_tabBar);
	addToolBar(toolBar);
}
开发者ID:thesmartwon,项目名称:OpenChess,代码行数:24,代码来源:mainwindow.cpp

示例6: createToolBars

void MainWindow::createToolBars()
{
	m_tabBar = new GameTabBar();
	m_tabBar->setDocumentMode(true);
	m_tabBar->setTabsClosable(true);
	m_tabBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);

	connect(m_tabBar, SIGNAL(currentChanged(int)),
		this, SLOT(onTabChanged(int)));
	connect(m_tabBar, SIGNAL(tabCloseRequested(int)),
		this, SLOT(onTabCloseRequested(int)));
	connect(m_showPreviousTabAct, SIGNAL(triggered()),
		m_tabBar, SLOT(showPreviousTab()));
	connect(m_showNextTabAct, SIGNAL(triggered()),
		m_tabBar, SLOT(showNextTab()));

	QToolBar* toolBar = new QToolBar(tr("Game Tabs"));
	toolBar->setVisible(false);
	toolBar->setFloatable(false);
	toolBar->setMovable(false);
	toolBar->setAllowedAreas(Qt::TopToolBarArea);
	toolBar->addWidget(m_tabBar);
	addToolBar(toolBar);
}
开发者ID:rwst,项目名称:cutechess,代码行数:24,代码来源:mainwindow.cpp

示例7: restoreState

bool QToolBarAreaLayout::restoreState(QDataStream &stream, const QList<QToolBar*> &_toolBars, uchar tmarker)
{
    QList<QToolBar*> toolBars = _toolBars;
    int lines;
    stream >> lines;

    for (int j = 0; j < lines; ++j) {
        int pos;
        stream >> pos;
        if (pos < 0 || pos >= QInternal::DockCount)
            return false;
        int cnt;
        stream >> cnt;

        QToolBarAreaLayoutInfo &dock = docks[pos];
        QToolBarAreaLayoutLine line(dock.o);

        for (int k = 0; k < cnt; ++k) {
            QToolBarAreaLayoutItem item;

            QString objectName;
            stream >> objectName;
            uchar shown;
            stream >> shown;
            stream >> item.pos;
            stream >> item.size;

            /*
               4.3.0 added floating toolbars, but failed to add the ability to restore them.
               We need to store there geometry (four ints). We cannot change the format in a
               patch release (4.3.1) by adding ToolBarStateMarkerEx2 to signal extra data. So
               for now we'll pack it in the two legacy ints we no longer used in Qt4.3.0.
               In 4.4, we should add ToolBarStateMarkerEx2 and fix this properly.
            */

            QRect rect;
            bool floating = false;
            uint geom0, geom1;
            stream >> geom0;
            if (tmarker == ToolBarStateMarkerEx) {
                stream >> geom1;
                rect = unpackRect(geom0, geom1, &floating);
            }

            QToolBar *toolBar = 0;
            for (int x = 0; x < toolBars.count(); ++x) {
                if (toolBars.at(x)->objectName() == objectName) {
                    toolBar = toolBars.takeAt(x);
                    break;
                }
            }
            if (toolBar == 0) {
                continue;
            }

            item.widgetItem = new QWidgetItem(toolBar);
            toolBar->setOrientation(floating ? Qt::Horizontal : dock.o);
            toolBar->setVisible(shown);
            toolBar->d_func()->setWindowState(floating, true, rect);

            line.toolBarItems.append(item);
        }

        dock.lines.append(line);
    }
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:65,代码来源:qtoolbararealayout.cpp


注:本文中的QToolBar::setVisible方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。