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


C++ QDockWidget::setTitleBarWidget方法代码示例

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


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

示例1: setTitleBarWidget

void tst_QDockWidget::setTitleBarWidget()
{
    //test the successive usage of setTitleBarWidget

    QDockWidget dock;
    QWidget w, w2;

    dock.show();
    qApp->processEvents();

    dock.setTitleBarWidget(&w);
    qApp->processEvents();
    QCOMPARE(w.isVisible(), true);

    //set another widget as the titlebar widget
    dock.setTitleBarWidget(&w2); // this used to crash (task 184668)
    qApp->processEvents();
    QCOMPARE(w.isVisible(), false);
    QCOMPARE(w2.isVisible(), true);

    //tries to reset the titlebarwidget to none
    dock.setTitleBarWidget(0);
    qApp->processEvents();
    QCOMPARE(w.isVisible(), false);
    QCOMPARE(w2.isVisible(), false);
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:26,代码来源:tst_qdockwidget.cpp

示例2: sender

void
Style::dockLocationChanged( Qt::DockWidgetArea /*area*/ )
{
    QDockWidget *dock = carriedDock ? carriedDock : qobject_cast<QDockWidget*>( sender() );
    if ( !dock )
        return;
    if ( dock->isFloating() || !Hacks::config.lockDocks )
    {
        if ( QWidget *title = dock->titleBarWidget() )
        {
            if ( title->objectName() ==  "bespin_docktitle_dummy" )
            {
                dock->setTitleBarWidget(0);
                title->deleteLater();
            }
            else
                title->show();
        }
    }
    else
    {
        QWidget *title = dock->titleBarWidget();
        if ( !title )
        {
            title = new QWidget;
            title->setObjectName( "bespin_docktitle_dummy" );
            dock->setTitleBarWidget( title );
        }
        if ( title->objectName() ==  "bespin_docktitle_dummy" )
            dock->titleBarWidget()->hide();
    }
}
开发者ID:ViktorNova,项目名称:virtuality,代码行数:32,代码来源:docks.cpp

示例3: slotShowTitleBars

void HideTitleBars::slotShowTitleBars(bool show)
{
    QList <QDockWidget *> docks = pCore->window()->findChildren<QDockWidget *>();
    for (int i = 0; i < docks.count(); ++i) {
        QDockWidget* dock = docks.at(i);
        QWidget *bar = dock->titleBarWidget();
        if (show) {
            if (dock->isFloating()) {
                if (bar) {
                    dock->setTitleBarWidget(0);
                    delete bar;
                }
                continue;
            }
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
            // Since Qt 5.6 we only display title bar in non tabbed dockwidgets
            QList <QDockWidget*> docked = pCore->window()->tabifiedDockWidgets(dock);
            if (docked.isEmpty()) {
                if (bar) {
                    dock->setTitleBarWidget(0);
                    delete bar;
                }
                continue;
            } else {
                bool hasVisibleDockSibling = false;
                foreach(QDockWidget *sub, docked) {
                    if (sub->toggleViewAction()->isChecked()) {
                        // we have another docked widget, so tabs are visible and can be used instead of title bars
                        hasVisibleDockSibling = true;
                        break;
                    }
                }
                if (!hasVisibleDockSibling) {
                    if (bar) {
                        dock->setTitleBarWidget(0);
                        delete bar;
                    }
                    continue;
                }
            }
            if (!bar) {
                dock->setTitleBarWidget(new QWidget);
            }
#else
            if (bar) {
                dock->setTitleBarWidget(0);
                delete bar;
            }
#endif
        } else {
            if (!dock->isFloating() && !bar) {
                dock->setTitleBarWidget(new QWidget);
            }
        }
    }
开发者ID:JongHong,项目名称:kdenlive,代码行数:55,代码来源:hidetitlebars.cpp

示例4: newDockWidgetFor

QDockWidget* MainWindow::newDockWidgetFor(QWidget *w)
{
	QDockWidget *dock = new QDockWidget(this);
	dock->setAllowedAreas(Qt::TopDockWidgetArea);
	dock->setWidget(w);
	dock->setFeatures(QDockWidget::NoDockWidgetFeatures);
	dock->setTitleBarWidget(new QWidget(this));
	addDockWidget(Qt::TopDockWidgetArea, dock);
	return dock;
}
开发者ID:agocke,项目名称:neovim-qt,代码行数:10,代码来源:mainwindow.cpp

示例5: createDockPanel

/******************************************************************************
* Creates a dock panel.
******************************************************************************/
void MainWindow::createDockPanel(const QString& caption, const QString& objectName, Qt::DockWidgetArea dockArea, Qt::DockWidgetAreas allowedAreas, QWidget* contents)
{
	QDockWidget* dockWidget = new QDockWidget(caption, this);
	dockWidget->setObjectName(objectName);
	dockWidget->setAllowedAreas(allowedAreas);
	dockWidget->setFeatures(QDockWidget::DockWidgetClosable);
	dockWidget->setWidget(contents);
	dockWidget->setTitleBarWidget(new QWidget());
	addDockWidget(dockArea, dockWidget);
}
开发者ID:bitzhuwei,项目名称:OVITO_sureface,代码行数:13,代码来源:MainWindow.cpp

示例6: QMainWindow

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QDockWidget *testDock = new QDockWidget(tr("Test Dock"));
    testDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable
                          | QDockWidget::DockWidgetMovable);
    testDock->setMinimumWidth(200);
    testDock->setStyleSheet(tr("background-color:green;"));

    MyDockTitleBar *titlebar1 = new MyDockTitleBar(testDock);
    testDock->setTitleBarWidget(titlebar1);

    QWidget *testWidget = new QWidget;
    QVBoxLayout *box = new QVBoxLayout;

    QPushButton *okButton = new QPushButton(tr("Ok"));
    okButton->setStyleSheet(tr("background-color:white;"));
    box->addWidget(okButton);
    testWidget->setLayout(box);

    testDock->setWidget(testWidget);

    //////////////////////////////////////////////////////////

    QDockWidget *testDock2 = new QDockWidget(tr("Test Dock2"));
    testDock2->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable
                           | QDockWidget::DockWidgetMovable);
    testDock2->setMinimumWidth(200);
    testDock2->setStyleSheet(tr("background-color:orange;"));

    MyDockTitleBar *titlebar2 = new MyDockTitleBar(testDock2);
    testDock2->setTitleBarWidget(titlebar2);

    QWidget *testWidget2 = new QWidget;
    QVBoxLayout *box2 = new QVBoxLayout;

    QPushButton *okButton2 = new QPushButton(tr("Ok"));
    okButton2->setStyleSheet(tr("background-color:white;"));
    box2->addWidget(okButton2);
    testWidget2->setLayout(box2);

    testDock2->setWidget(testWidget2);

    //////////////////////////////////////////////////////////

    this->addDockWidget(Qt::LeftDockWidgetArea, testDock);

    this->setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::West);
    this->tabifyDockWidget(testDock, testDock2);
}
开发者ID:Iownnoname,项目名称:qt,代码行数:53,代码来源:mainwindow.cpp

示例7: QDockWidget

/**
Returns the pointer to the dock widget for the given dock area.

If dockwidget corresponding to the dock area is not found, new dockwidget for that
dock area is created.

\param area DockWidgetArea for which corresponding dockwidget is returned.

*/
QDockWidget* GCF::Components::MainWindow::dockWidget(Qt::DockWidgetArea area)
{
    QDockWidget* ret = 0;

    if(d->dockWidgetMap.contains(area))
        ret = d->dockWidgetMap[area];

    if(!ret)
    {
        // create the dock widget
        ret = new QDockWidget(this);
        ret->setAllowedAreas(area);
		ret->setFeatures(QDockWidget::NoDockWidgetFeatures);
		
		// This is to remove the title bar
		QWidget* titleWidget = new QWidget(this);
		ret->setTitleBarWidget( titleWidget );

        // place a tab widget on the dock widget
        QTabWidget* tabWidget = new QTabWidget(ret);
        ret->setWidget(tabWidget);

        // position the tabs in the right place.
        switch(area)
        {
        case Qt::LeftDockWidgetArea:
            tabWidget->setTabPosition(QTabWidget::North);
            break;
        case Qt::RightDockWidgetArea:
            tabWidget->setTabPosition(QTabWidget::North);
            break;
        case Qt::TopDockWidgetArea:
            tabWidget->setTabPosition(QTabWidget::North);
            // tabWidget->setFixedHeight(150);
            // ret->setFixedHeight(150);
            break;
        case Qt::BottomDockWidgetArea:
            tabWidget->setTabPosition(QTabWidget::North);
            // tabWidget->setFixedHeight(150);
            // ret->setFixedHeight(150);
            break;
        default:
            break;
        }
    }
	addDockWidget(area, ret);
    d->dockWidgetMap[area] = ret;
    ret->hide();
	

    return ret;
}
开发者ID:banduladh,项目名称:levelfour,代码行数:61,代码来源:MainWindow.cpp

示例8: createHeader

void MainWindow::createHeader()
{
//    QToolBar *tb = new QToolBar(this);
    QDockWidget *header = new QDockWidget(this);
    QHBoxLayout *ly = new QHBoxLayout();
    QFrame *frm = new QFrame();
    QPushButton *pbExit = new QPushButton();
    pbExit->setIcon(QIcon(":/images/meiti-up.png"));
    pbExit->setIconSize(QSize(40,40));

    pbExit->setFocusPolicy(Qt::NoFocus);
    pbExit->setFocusProxy(0);
    pbExit->setStyleSheet(QString("background-image: url(:/images/meiti-up.png);\n\n#pbExit:pressed {background-image: url(:/images/meiti-down.png) 4 4 4 4 strech strech;}\n\n#pbExit:hover {background-image: url(:/images/meiti-over.png) 4 4 4 4 strech strech;}\n"));

    connect(pbExit, SIGNAL(clicked()), qApp, SLOT(quit()));


    ly->addWidget(pbExit);
    ly->setAlignment(pbExit,Qt::AlignCenter);
    frm->setLayout(ly);
    frm->setAttribute(Qt::WA_TranslucentBackground, true);        // 设置背景透明(version >= QT4.5

    header->setWidget(frm);

    header->setAttribute(Qt::WA_TranslucentBackground, true);        // 设置背景透明(version >= QT4.5

    //header->setWindowFlags(Qt::FramelessWindowHint);
    header->setWindowTitle(QString(""));
    header->setTitleBarWidget(new QWidget);
    header->setFocusPolicy(Qt::NoFocus);
    header->setFocusProxy(0);
    header->setFeatures(QDockWidget::NoDockWidgetFeatures);
    header->setBaseSize(0,40);

    addDockWidget(Qt::TopDockWidgetArea,header, Qt::Horizontal);

//    tb->addWidget(frm);
//    pbExit->setText(QString("%1--%2--%3").arg(this->width()).arg(tb->width()).arg(pbExit->width()));
//
//    tb->setMovable(false);
//
//    this->addToolBar(tb);

//	dockWidget->setWidget(keyboardfrm);
//	dockWidget->setAllowedAreas(Qt::BottomDockWidgetArea);
//	dockWidget->setFeatures(QDockWidget::DockWidgetClosable);
//	addDockWidget(Qt::BottomDockWidgetArea,dockWidget);
}
开发者ID:ghl800,项目名称:hipibrowser,代码行数:48,代码来源:mainwindow.cpp

示例9: createDatabaseExplorer

    void MainWindow::createDatabaseExplorer()
    {
        ExplorerWidget *explorer = new ExplorerWidget(this);
        AppRegistry::instance().bus()->subscribe(explorer, ConnectingEvent::Type);
        AppRegistry::instance().bus()->subscribe(explorer, ConnectionFailedEvent::Type);
        AppRegistry::instance().bus()->subscribe(explorer, ConnectionEstablishedEvent::Type);

        QDockWidget *explorerDock = new QDockWidget(tr("Database Explorer"));
        explorerDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
        explorerDock->setWidget(explorer);
        explorerDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable);

        QWidget *titleWidget = new QWidget(this);         // this lines simply remove
        explorerDock->setTitleBarWidget(titleWidget);     // title bar widget.

        QAction *actionExp = explorerDock->toggleViewAction();

        // Adjust any parameter you want.  
        actionExp->setText(QString("&Explorer"));
        actionExp->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_E));  
        actionExp->setStatusTip(QString("Press to show/hide Database Explorer panel."));
        actionExp->setChecked(true);
        // Install action in the menu.  
        _viewMenu->addAction(actionExp);

        addDockWidget(Qt::LeftDockWidgetArea, explorerDock);

        LogWidget *log = new LogWidget(this);        
        VERIFY(connect(&Logger::instance(), SIGNAL(printed(const QString&, mongo::LogLevel)), log, SLOT(addMessage(const QString&, mongo::LogLevel))));
        _logDock = new QDockWidget(tr("Logs"));
        QAction *action = _logDock->toggleViewAction();
        // Adjust any parameter you want.  
        action->setText(QString("&Logs"));
        action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));  
        //action->setStatusTip(QString("Press to show/hide Logs panel."));  //commented for now because this message hides Logs button in status bar :)
        action->setChecked(false);
        // Install action in the menu.
        _viewMenu->addAction(action);

        _logDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea | Qt::TopDockWidgetArea);
        _logDock->setWidget(log);
        _logDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable);
        _logDock->setVisible(false);
        addDockWidget(Qt::BottomDockWidgetArea, _logDock);
    }
开发者ID:Dinesh-Ramakrishnan,项目名称:robomongo,代码行数:45,代码来源:MainWindow.cpp

示例10: sets

WindowImpl::WindowImpl():
    m_ui(new Ui::WindowImpl)
{
    m_ui->setupUi(this);
    QApplication::setStyle(new QNotoStyle);

    QSettings sets(QSettings::IniFormat, QSettings::UserScope, "qnoto", "qnoto");
    restoreGeometry(sets.value("MainWindow/Geometry").toByteArray());

    QDockWidget *dockWidget = new QDockWidget("Left side", this);
    dockWidget->setContentsMargins(0, 0, 0, 0);
    dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea);
    dockWidget->setFloating(false);
    dockWidget->setFeatures(dockWidget->features() ^ QDockWidget::DockWidgetClosable ^ QDockWidget::DockWidgetMovable ^ QDockWidget::DockWidgetFloatable);
    dockWidget->setTitleBarWidget(new QWidget);
    m_split = new SideSplit(this);
    dockWidget->setWidget(m_split);
    addDockWidget(Qt::LeftDockWidgetArea, dockWidget);

    m_editors = qnoto::plugin<qnoto::Editors>();
    connect(m_editors, &qnoto::Editors::updateEditMenu, this, &WindowImpl::updateEditMenu);

    setCentralWidget(m_editors);

    const auto& acts = m_editors->actions();
    for(const auto& it: acts){
        if (it->property("name").toString().startsWith("File_")){
            m_ui->menuFile->addAction(it);
        }
        if (it->property("name").toString().startsWith("Window_")){
            m_ui->menuWindow->addAction(it);
        }
    }

    connect(m_ui->actionPreferences, &QAction::triggered, this, &WindowImpl::showPreferences);

    m_split->restoreState(sets);
    m_editors->restoreState();
}
开发者ID:shujaatak,项目名称:qnoto,代码行数:39,代码来源:window-impl.cpp

示例11: QMainWindow

MainWindow::MainWindow(QWidget* parent)
    : QMainWindow(parent)
{
    const int screenWidth = QApplication::desktop()->width();
    const int screenHeight = QApplication::desktop()->height();
    const int appWidth = 500;
    const int appHeight = 300;

    setGeometry((screenWidth - appWidth) / 2, (screenHeight - appHeight) / 2, appWidth, appHeight);

    setObjectName("mainwindow");
    setWindowTitle("developers' test version, not for public use");
    setWindowIcon(QIcon(":/icons/icon64.png"));
    setContextMenuPolicy(Qt::PreventContextMenu);

    QDockWidget* friendDock = new QDockWidget(this);
    friendDock->setObjectName("FriendDock");
    friendDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
    friendDock->setTitleBarWidget(new QWidget(friendDock));
    friendDock->setContextMenuPolicy(Qt::PreventContextMenu);
    addDockWidget(Qt::LeftDockWidgetArea, friendDock);

    QWidget* friendDockWidget = new QWidget(friendDock);
    QVBoxLayout* layout = new QVBoxLayout(friendDockWidget);
    layout->setMargin(0);
    layout->setSpacing(0);
    friendDock->setWidget(friendDockWidget);

    ourUserItem = new OurUserItemWidget(this);
    friendsWidget = new FriendsWidget(friendDockWidget);

    // Create toolbar
    QToolBar *toolBar = new QToolBar(this);
    toolBar->setToolButtonStyle(Qt::ToolButtonIconOnly);
    toolBar->setIconSize(QSize(16, 16));
    toolBar->setFocusPolicy(Qt::ClickFocus);

    QToolButton *addFriendButton = new QToolButton(toolBar);
    addFriendButton->setIcon(QIcon("://icons/user_add.png"));
    addFriendButton->setToolTip(tr("Add friend"));
    connect(addFriendButton, &QToolButton::clicked, friendsWidget, &FriendsWidget::onAddFriendButtonClicked);

    QWidget *spacer = new QWidget(toolBar);
    spacer->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Preferred);

    QToolButton *menuButton = new QToolButton(toolBar);
    menuButton->setIcon(QIcon("://icons/cog.png"));
    menuButton->setToolTip(tr("Mainmenu"));
    menuButton->setPopupMode(QToolButton::InstantPopup);
    QMenu *mainmenu = new QMenu(menuButton);
    mainmenu->addAction(QIcon(":/icons/setting_tools.png"), tr("Settings"), this, SLOT(onSettingsActionTriggered()));
    mainmenu->addSeparator();
    mainmenu->addAction(tr("About %1").arg(AppInfo::name), this, SLOT(onAboutAppActionTriggered()));
    mainmenu->addAction(tr("About Qt"), qApp, SLOT(aboutQt()));
    mainmenu->addSeparator();
    mainmenu->addAction(tr("Quit"), this, SLOT(onQuitApplicationTriggered()), QKeySequence::Quit);
    menuButton->setMenu(mainmenu);

    toolBar->addWidget(addFriendButton);
    toolBar->addWidget(spacer);
    toolBar->addWidget(menuButton);
    // Create toolbar end

    layout->addWidget(ourUserItem);
    layout->addWidget(friendsWidget);
    layout->addWidget(toolBar);

    PagesWidget* pages = new PagesWidget(this);
    connect(friendsWidget, &FriendsWidget::friendAdded, pages, &PagesWidget::addPage);
    connect(friendsWidget, &FriendsWidget::friendSelectionChanged, pages, &PagesWidget::activatePage);
    connect(friendsWidget, &FriendsWidget::friendStatusChanged, pages, &PagesWidget::statusChanged);

    //FIXME: start core in a separate function
    //all connections to `core` should be done after its creation because it registers some types
    core = new Core();

    coreThread = new QThread(this);
    core->moveToThread(coreThread);
    connect(coreThread, &QThread::started, core, &Core::start);

    qRegisterMetaType<Status>("Status");

    connect(core, &Core::connected, this, &MainWindow::onConnected);
    connect(core, &Core::disconnected, this, &MainWindow::onDisconnected);
    connect(core, &Core::friendRequestRecieved, this, &MainWindow::onFriendRequestRecieved);
    connect(core, SIGNAL(friendStatusChanged(int, Status)), friendsWidget, SLOT(setStatus(int, Status)));
    connect(core, &Core::friendAddressGenerated, ourUserItem, &OurUserItemWidget::setFriendAddress);
    connect(core, &Core::friendAdded, friendsWidget, &FriendsWidget::addFriend);
    connect(core, &Core::friendMessageRecieved, pages, &PagesWidget::messageReceived);
    connect(core, &Core::actionReceived, pages, &PagesWidget::actionReceived);
    connect(core, &Core::friendUsernameChanged, friendsWidget, &FriendsWidget::setUsername);
    connect(core, &Core::friendUsernameChanged, pages, &PagesWidget::usernameChanged);
    connect(core, &Core::friendRemoved, friendsWidget, &FriendsWidget::removeFriend);
    connect(core, &Core::friendRemoved, pages, &PagesWidget::removePage);
    connect(core, &Core::failedToRemoveFriend, this, &MainWindow::onFailedToRemoveFriend);
    connect(core, &Core::failedToAddFriend, this, &MainWindow::onFailedToAddFriend);
    connect(core, &Core::messageSentResult, pages, &PagesWidget::messageSentResult);
    connect(core, &Core::actionSentResult, pages, &PagesWidget::actionResult);

    coreThread->start(/*QThread::IdlePriority*/);
//.........这里部分代码省略.........
开发者ID:nurutot,项目名称:ProjectTox-Qt-GUI,代码行数:101,代码来源:mainwindow.cpp

示例12: mouseDoubleClickEvent


//.........这里部分代码省略.........
	bookmarksContextMenu_->addAction(tr("Remove From List"), this, SLOT(removeBookmark()));
	bookmarksContextMenu_->addSeparator();
	bookmarksShowFullPathAction_ = bookmarksContextMenu_->addAction(tr("Show Full Path"));
	bookmarksShowFullPathAction_->setCheckable(true);
	bookmarksShowFullPathAction_->setChecked(bookmarksModel_->pathReduction() == -1);
	connect(bookmarksShowFullPathAction_, SIGNAL(toggled(bool)), this, SLOT(bookmarksShowFullPath(bool)));
	
	#ifdef Q_WS_MAC
	{
		QProxyStyle* proxyStyle = qobject_cast<QProxyStyle*>(style());
		QMacStyle* macStyle = qobject_cast<QMacStyle*>((proxyStyle) ? proxyStyle->baseStyle() : style());
		if (macStyle) {
			macStyle->setFocusRectPolicy(dirView_, QMacStyle::FocusDisabled);
			macStyle->setFocusRectPolicy(recentView_, QMacStyle::FocusDisabled);
			macStyle->setFocusRectPolicy(dirView_, QMacStyle::FocusDisabled);
			macStyle->setFocusRectPolicy(bookmarksView_, QMacStyle::FocusDisabled);
		}
	}
	#endif
	
	//--------------------------------------------------------------------------
	// layout widgets
	
	handle_ = new QxControl(this, new QxVisual(styleManager()->style("fileBrowserSplitter")));
	handle_->visual()->setText("");
	handleTextRecent_ = tr("Recent Places");
	handleTextBookmarks_ = tr("Bookmarks");
	
	bottomStack_ = new QxControl(this);
	bottomStackLayout_ = new QStackedLayout;
	bottomStackLayout_->addWidget(recentView_);
	bottomStackLayout_->addWidget(bookmarksView_);
	bottomStack_->setLayout(bottomStackLayout_);
	bottomStack_->setVisible(false);
	
	splitter_ = new QxSplitter(this);
	splitter_->setOrientation(Qt::Vertical);
	splitter_->setHandle(1, handle_);
	splitter_->setHandleWidth(styleManager()->constant("fileBrowserSplitterWidth"));
	splitter_->addWidget(dirView_);
	/*{
		QxControl* carrier = new QxControl(this, new QxVisual(styleManager()->style("fileBrowserDirView")));
		QGridLayout* layout = new QGridLayout;
		layout->setSpacing(0);
		layout->setMargin(0);
		layout->addWidget(dirView_);
		carrier->setLayout(layout);
		splitter_->addWidget(carrier);
	}*/
	splitter_->addWidget(bottomStack_);
	
	// make dirView_ grow/shrink dynamically, while bottomStack_ keeps user-defined size
	splitter_->setStretchFactor(0, 1);
	splitter_->setStretchFactor(1, 0);
	
	QDockWidget* dock = qobject_cast<QDockWidget*>(parent);
	if (dock) {
		dock->setWidget(this);
		// connect(dock, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(adaptToDockLocation(Qt::DockWidgetArea)));
	}
	
	QVBoxLayout* col = new QVBoxLayout;
	col->setSpacing(0);
	col->setMargin(0);
	{
		QxControl* carrier = new QxControl(parent, new QxVisual(styleManager()->style("fileBrowserNavCarrier")));
		QHBoxLayout* row = new QHBoxLayout;
		row->setSpacing(0);
		row->setMargin(0);
		row->addWidget(gotoButton_);
		row->addStretch();
		row->addWidget(cdUpButton);
		carrier->setLayout(row);
		
		if (dock)
			dock->setTitleBarWidget(carrier);
		else
			col->addWidget(carrier);
	}
	col->addWidget(splitter_);
	col->addWidget(styleManager()->hl(this));
	{
		QBoxLayout* row = new QBoxLayout(QBoxLayout::LeftToRight);
		row->setSpacing(0);
		row->setMargin(0);
		row->addWidget(plusButton);
		row->addWidget(styleManager()->vl(this));
		row->addWidget(wheelButton);
		row->addWidget(styleManager()->vl(this));
		row->addWidget(recentButton);
		row->addWidget(styleManager()->vl(this));
		row->addWidget(bookmarksButton);
		row->addWidget(styleManager()->vl(this));
		row->addWidget(statusBar_);
		col->addLayout(row);
		
		bottomToolLayout_ = row;
	}
	setLayout(col);
}
开发者ID:corelon,项目名称:paco,代码行数:101,代码来源:QxFileBrowser.cpp

示例13: QMainWindow

Window::Window(QWidget* parent) :
    QMainWindow(parent)
{
    setObjectName("ChatWindow");

    Settings::getInstance().load();
    connect(&Settings::getInstance(), &Settings::dataChanged, this, &Window::applySettings);

    QToolBar* toolbar = new QToolBar(this);
    toolbar->setIconSize(QSize(24, 24));
    toolbar->setFloatable(false);
    toolbar->setContextMenuPolicy(Qt::PreventContextMenu);
    addToolBar(toolbar);

    //QAction* refreshAction = toolbar->addAction(QIcon(":/icons/refresh.png"), "refresh");
    //connect(refreshAction, SIGNAL(triggered()), this, SLOT(refreshPlanets()));

    QDockWidget* inputDock = new QDockWidget(this);
    inputDock->setObjectName("Input dock");
    inputDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
    inputDock->setTitleBarWidget(new QWidget(inputDock));
    inputDock->setContextMenuPolicy(Qt::PreventContextMenu);
    addDockWidget(Qt::BottomDockWidgetArea, inputDock);
    QWidget* inputDockWidget = new QWidget(inputDock);
    QHBoxLayout* inputDockWidgetLayout = new QHBoxLayout(inputDockWidget);
    nickLabel = new QLabel(inputDockWidget);
    nickLabel->hide();
    inputLine = new QLineEdit(inputDockWidget);

    connect(inputLine, &QLineEdit::returnPressed, this, &Window::sendMessage);
    inputDockWidgetLayout->addWidget(nickLabel);
    inputDockWidgetLayout->addWidget(inputLine);
    inputDockWidgetLayout->setContentsMargins(2, 2, 2, 6);
    inputDockWidget->setLayout(inputDockWidgetLayout);
    inputDock->setFixedHeight(inputDock->height());
    inputDock->setWidget(inputDockWidget);

    QDockWidget* tabDock = new QDockWidget(this);
    tabDock->setObjectName("Tab dock");
    tabDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
    tabDock->setTitleBarWidget(new QWidget(tabDock));
    tabDock->setContextMenuPolicy(Qt::PreventContextMenu);
    addDockWidget(Qt::LeftDockWidgetArea, tabDock);
    setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
    setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
    tabTree = new TabTree(tabDock, 100);
    tabTree->setHeaderLabel("Chats");
    tabTree->setIndentation(8);
    tabTree->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    tabTree->setMinimumWidth(1);
    tabTree->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
    tabDock->setWidget(tabTree);
    tabTree->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(tabTree, &QTreeWidget::itemSelectionChanged, this, &Window::tabSelected);
    connect(tabTree, &QTreeWidget::customContextMenuRequested, this, &Window::showTabTreeContextMenu);

    QAction* connectAction = new QAction(QIcon(":/icons/connect.png"), "Connect", toolbar);
    QAction* disconnectAction = new QAction(QIcon(":/icons/disconnect.png"), "Disconnect", toolbar);
    QAction* settingsAction = toolbar->addAction(QIcon(":/icons/settings.png"), "Settings");
    connect(connectAction, &QAction::triggered, this, &Window::connectToServer);
    connect(disconnectAction, &QAction::triggered, this, &Window::disconnectFromServer);
    connect(settingsAction, &QAction::triggered, this, &Window::showSettingsDialog);
    toolbar->addActions(QList<QAction*>() << connectAction << disconnectAction << settingsAction);

    serverTab = new QTreeWidgetItem(tabTree, QStringList() << "IRC Server");
    tabTree->addTopLevelItem(serverTab);

    userDock = new QDockWidget(this);
    userDock->setObjectName("User dock");
    userDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
    userDock->setTitleBarWidget(new QWidget(userDock));
    userDock->setContextMenuPolicy(Qt::PreventContextMenu);
    addDockWidget(Qt::RightDockWidgetArea, userDock);
    setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
    setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
    userTree = new UserTree(userDock, 100);
    userTree->setItemsExpandable(false);
    userTree->setIndentation(8);
    userTree->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    userTree->setMinimumWidth(1);
    userTree->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
    userDock->setWidget(userTree);
    connect(userTree, &UserTree::privateActionTriggered, this, &Window::startPrivate);

    topicDock = new QDockWidget(this);
    topicDock->setObjectName("Topic dock");
    topicDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
    topicDock->setTitleBarWidget(new QWidget(topicDock));
    topicDock->setContextMenuPolicy(Qt::PreventContextMenu);
    addDockWidget(Qt::TopDockWidgetArea, topicDock);
    topicLine = new TopicLabel(topicDock);
    topicDock->setWidget(topicLine);

    QMainWindow* pagesWindow = new QMainWindow(0);
    pages = new QStackedWidget(pagesWindow);

    serverPage = new ServerPage(serverTab, tabTree);
    connect(serverPage, &ServerPage::connectActionTriggered,    this, &Window::connectToServer);
    connect(serverPage, &ServerPage::disconnectActionTriggered, this, &Window::disconnectFromServer);

//.........这里部分代码省略.........
开发者ID:nurupo,项目名称:nfk-lobby,代码行数:101,代码来源:chatwindow.cpp

示例14: createDockWidget

void MainWindow::createDockWidget() {
    signalMapper = new QSignalMapper(this);

    // Header Widget
    QWidget* headerWidget = new QWidget;
    headerWidget->setFixedHeight(109);

    QDockWidget* headerDockWidget = new QDockWidget(this);
    headerDockWidget->setObjectName("headerDockWidget");
    headerDockWidget->setFloating(false);
    headerDockWidget->setTitleBarWidget(new QWidget);
    headerDockWidget->setWidget(headerWidget);

    this->addDockWidget(Qt::TopDockWidgetArea,headerDockWidget);

    // Right Panel Widget
    rightPanelWidget = new QWidget;
    rightPanelWidget->setObjectName("rightPanelWidget");
    rightPanelWidget->setFixedWidth(213);
    rightPanelWidget->setFixedHeight(481);
    QDockWidget* rightDockWidget = new QDockWidget(this);
    rightDockWidget->setObjectName("rightDockWidget");
    rightDockWidget->setFloating(false);
    rightDockWidget->setTitleBarWidget(new QWidget);
    rightDockWidget->setWidget(rightPanelWidget);

    this->addDockWidget(Qt::RightDockWidgetArea,rightDockWidget);

    // Set geometry for each button at fixed place.
    int y_aix = 8;
    int x_aix = 15;
    int button_height = 58;
    int button_width = 183;
    int spacing = 1 ;

    QPushButton* homeButton = new QPushButton(rightPanelWidget);
    homeButton->setObjectName("0_toolButton");
    homeButton->setGeometry(x_aix,y_aix,button_width,button_height);
    homeButton->setStyleSheet("QPushButton {background-image: url(:/images/home.png);background-color: transparent;} QPushButton:hover {background-image: url(:/images/home-hover.png);background-color: transparent;} QPushButton:pressed,QPushButton:checked {background-image: url(:/images/home-checked.png);background-color: transparent;}");
    homeButton->setCheckable(true);
    homeButton->setChecked(true);
    homeButton->setToolTip("الرئيسية");
    homeButton->setStatusTip("البداية لحاجب ويمكنك من خلالها التحكم في عمل خدمات حاحب على كل المستخدمين بالاضافة الى خيارات اخرى ...");
    connect(homeButton,SIGNAL(clicked()),signalMapper,SLOT(map()));
    signalMapper->setMapping(homeButton,Home);

    y_aix += button_height + spacing;
    QPushButton* userSettingsButton = new QPushButton(rightPanelWidget);
    userSettingsButton->setObjectName("1_toolButton");
    userSettingsButton->setGeometry(x_aix,y_aix,button_width,button_height);
    userSettingsButton->setStyleSheet("QPushButton {background-image: url(:/images/userSettings.png);background-color: transparent;} QPushButton:hover {background-image: url(:/images/userSettings-hover.png);background-color: transparent;} QPushButton:pressed,QPushButton:checked {background-image: url(:/images/userSettings-checked.png);background-color: transparent;}");
    userSettingsButton->setCheckable(true);
    userSettingsButton->setToolTip("إعدادات المستخدم");
    userSettingsButton->setStatusTip("إعدادات المستخدم تمكنك من تفعيل او تعطيل خدمات حاجب لمستخدم ما ...");
    connect(userSettingsButton,SIGNAL(clicked()),signalMapper,SLOT(map()));
    signalMapper->setMapping(userSettingsButton,UserSettings);

    y_aix += button_height + spacing;
    QPushButton* serviceLogButton = new QPushButton(rightPanelWidget);
    serviceLogButton->setObjectName("2_toolButton");
    serviceLogButton->setGeometry(x_aix,y_aix,button_width,button_height);
    serviceLogButton->setStyleSheet("QPushButton {background-image: url(:/images/userLogs.png);background-color: transparent;} QPushButton:hover {background-image: url(:/images/userLogs-hover.png);background-color: transparent;} QPushButton:pressed,QPushButton:checked {background-image: url(:/images/userLogs-checked.png);background-color: transparent;}");
    serviceLogButton->setCheckable(true);
    serviceLogButton->setToolTip("سجلات المستخدمين");
    serviceLogButton->setStatusTip("من خلال السجلات يمكنك متابعة كافة الأحداث لكل المستخدمين ...");
    connect(serviceLogButton,SIGNAL(clicked()),signalMapper,SLOT(map()));
    signalMapper->setMapping(serviceLogButton,ServiceLog);

    y_aix += button_height + spacing;
    QPushButton* screenshotMonitorButton = new QPushButton(rightPanelWidget);
    screenshotMonitorButton->setObjectName("3_toolButton");
    screenshotMonitorButton->setGeometry(x_aix,y_aix,button_width,button_height);
    screenshotMonitorButton->setStyleSheet("QPushButton {background-image: url(:/images/screenshotsMonitor.png);background-color: transparent;} QPushButton:hover {background-image: url(:/images/screenshotsMonitor-hover.png);background-color: transparent;} QPushButton:pressed,QPushButton:checked {background-image: url(:/images/screenshotsMonitor-checked.png);background-color: transparent;}");
    screenshotMonitorButton->setCheckable(true);
    screenshotMonitorButton->setToolTip("مراقبة الشاشة");
    screenshotMonitorButton->setStatusTip("مشاهدة لقطات الشاشة لكل المستخدمين والتحكم بوقت أخذ اللقطات ...");
    connect(screenshotMonitorButton,SIGNAL(clicked()),signalMapper,SLOT(map()));
    signalMapper->setMapping(screenshotMonitorButton,ScreenshotMonitor);

    y_aix += button_height + spacing;
    QPushButton* surfeTimeButton = new QPushButton(rightPanelWidget);
    surfeTimeButton->setObjectName("4_toolButton");
    surfeTimeButton->setGeometry(x_aix,y_aix,button_width,button_height);
    surfeTimeButton->setStyleSheet("QPushButton {background-image: url(:/images/browseTime.png);background-color: transparent;} QPushButton:hover {background-image: url(:/images/browseTime-hover.png);background-color: transparent;} QPushButton:pressed,QPushButton:checked {background-image: url(:/images/browseTime-checked.png);background-color: transparent;}");
    surfeTimeButton->setCheckable(true);
    surfeTimeButton->setToolTip("زمن التصفح");
    surfeTimeButton->setStatusTip("تحديد وقت تصفح الاتنرنت لكل مستخدم لكافة أيام الأسبوع ...");
    connect(surfeTimeButton,SIGNAL(clicked()),signalMapper,SLOT(map()));
    signalMapper->setMapping(surfeTimeButton,SurfTime);

    y_aix += button_height + spacing;
    QPushButton* websiteLockButton = new QPushButton(rightPanelWidget);
    websiteLockButton->setObjectName("5_toolButton");
    websiteLockButton->setGeometry(x_aix,y_aix,button_width,button_height);
    websiteLockButton->setStyleSheet("QPushButton {background-image: url(:/images/websiteLock.png);background-color: transparent;} QPushButton:hover {background-image: url(:/images/websiteLock-hover.png);background-color: transparent;} QPushButton:pressed,QPushButton:checked {background-image: url(:/images/websiteLock-checked.png);background-color: transparent;}");
    websiteLockButton->setCheckable(true);
    websiteLockButton->setToolTip("حظر المواقع");
    websiteLockButton->setStatusTip("اضافة وازالة موقع من قائمة المواقع المحظورة ...");
    connect(websiteLockButton,SIGNAL(clicked()),signalMapper,SLOT(map()));
    signalMapper->setMapping(websiteLockButton,WebsiteLocker);
//.........这里部分代码省略.........
开发者ID:Axovera,项目名称:hajeb,代码行数:101,代码来源:mainwindow.cpp

示例15: dhtDialog

MainWindow::MainWindow(QWidget* parent)
    : QMainWindow(parent)
{
    const int screenWidth = QApplication::desktop()->width();
    const int screenHeight = QApplication::desktop()->height();
    const int appWidth = 500;
    const int appHeight = 300;

    setGeometry((screenWidth - appWidth) / 2, (screenHeight - appHeight) / 2, appWidth, appHeight);

    setWindowTitle("developers' test version, not for public use");

    QDockWidget* friendDock = new QDockWidget(this);
    friendDock->setFeatures(QDockWidget::NoDockWidgetFeatures);
    friendDock->setTitleBarWidget(new QWidget(friendDock));
    friendDock->setContextMenuPolicy(Qt::PreventContextMenu);
    addDockWidget(Qt::LeftDockWidgetArea, friendDock);

    QWidget* friendDockWidget = new QWidget(friendDock);
    QVBoxLayout* layout = new QVBoxLayout(friendDockWidget);
    layout->setMargin(0);
    layout->setSpacing(0);

    ourUserItem = new OurUserItemWidget(this);
    friendsWidget = new FriendsWidget(friendDockWidget);

    layout->addWidget(ourUserItem);
    layout->addWidget(friendsWidget);

    friendDock->setWidget(friendDockWidget);

    PagesWidget* pages = new PagesWidget(this);
    connect(friendsWidget, &FriendsWidget::friendAdded, pages, &PagesWidget::addPage);
    connect(friendsWidget, &FriendsWidget::friendRemoved, pages, &PagesWidget::removePage);
    connect(friendsWidget, &FriendsWidget::friendSelectionChanged, pages, &PagesWidget::activatePage);
    connect(friendsWidget, &FriendsWidget::friendRenamed, pages, &PagesWidget::usernameChanged);
    connect(friendsWidget, &FriendsWidget::friendStatusChanged, pages, &PagesWidget::statusChanged);

    //FIXME: execute dhtDialog before MainWindow in main.cpp
    DhtDialog dhtDialog(this);
    if (dhtDialog.exec() != QDialog::Accepted) {
        QTimer::singleShot(250, qApp, SLOT(quit()));
    }

    //FIXME: start core in a separate function
    //all connections to `core` should be done after its creation because it registers some types
    core = new Core(dhtDialog.getUserId(), dhtDialog.getIp(), dhtDialog.getPort());

    coreThread = new QThread(this);
    core->moveToThread(coreThread);
    connect(coreThread, &QThread::started, core, &Core::start);
    coreThread->start(/*QThread::IdlePriority*/);

    connect(core, &Core::friendRequestRecieved, this, &MainWindow::onFriendRequestRecieved);
    connect(core, &Core::friendStatusChanged, this, &MainWindow::onFriendStatusChanged);
    connect(core, &Core::userIdGererated, ourUserItem, &OurUserItemWidget::setUserId);
    connect(core, &Core::friendAdded, friendsWidget, &FriendsWidget::addFriend);
    connect(core, &Core::friendMessageRecieved, pages, &PagesWidget::messageReceived);

    connect(this, &MainWindow::friendRequestAccepted, core, &Core::acceptFirendRequest);

    connect(pages, &PagesWidget::messageSent, core, &Core::sendMessage);

    connect(friendsWidget, &FriendsWidget::friendRequested, core, &Core::requestFriendship);
    connect(friendsWidget, &FriendsWidget::friendRemoved, core, &Core::removeFriend);

    setCentralWidget(pages);
}
开发者ID:Captainhat,项目名称:ProjectTox-Qt-GUI,代码行数:68,代码来源:mainwindow.cpp


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