Exemple #1
0
void TabWidget::setTreeModeEnabled(bool enabled)
{
    if (isTreeModeEnabled() == enabled) {
        updateToolBar();
        return;
    }

    const QStringList tabs = this->tabs();

    if (enabled) {
        delete m_tabBar;
        m_tabBar = NULL;

        createTabTree();
        for (int i = 0; i < tabs.size(); ++i) {
            const QString &tabName = tabs[i];
            m_tabTree->insertTab(tabName, i, i == 0);
            m_tabTree->setTabItemCount(tabName, itemCountLabel(tabName));
        }

        m_tabTree->setCollapsedTabs(m_collapsedTabs);
    } else {
        m_collapsedTabs = m_tabTree->collapsedTabs();

        delete m_tabTree;
        m_tabTree = NULL;

        createTabBar();
        for (int i = 0; i < tabs.size(); ++i) {
            const QString &tabName = tabs[i];
            m_tabBar->insertTab(i, tabName);
            m_tabBar->setTabItemCount(tabName, itemCountLabel(tabName));
        }
    }
}
Exemple #2
0
TabWidget::TabWidget(QWidget *parent)
    : QWidget(parent)
    , m_toolBar(new QToolBar(this))
    , m_toolBarTree(new QToolBar(this))
    , m_tabBar(NULL)
    , m_tabTree(NULL)
    , m_stackedWidget(NULL)
    , m_hideTabBar(false)
{
    // Set object name for tool bars so they can be saved with QMainWindow::saveState().
    m_toolBar->setObjectName("toolBarTabBar");
    m_toolBarTree->setObjectName("toolBarTabTree");

    m_toolBar->setContextMenuPolicy(Qt::NoContextMenu);
    m_toolBarTree->setContextMenuPolicy(Qt::NoContextMenu);

    m_toolBar->installEventFilter(this);
    connect( m_toolBar, SIGNAL(orientationChanged(Qt::Orientation)),
             this, SLOT(onToolBarOrientationChanged(Qt::Orientation)) );

    QBoxLayout *layout = new QBoxLayout(QBoxLayout::TopToBottom, this);
    setLayout(layout);
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setSpacing(0);

    m_stackedWidget = new QStackedWidget(this);
    layout->addWidget(m_stackedWidget);

    createTabBar();

    addTabAction(this, QKeySequence::PreviousChild, this, SLOT(previousTab()));
    addTabAction(this, QKeySequence::NextChild, this, SLOT(nextTab()));
}
Exemple #3
0
void TabWidget::setTreeModeEnabled(bool enabled)
{
    if (isTreeModeEnabled() == enabled) {
        updateToolBar();
        return;
    }

    const QStringList tabs = this->tabs();

    if (enabled) {
        delete m_tabBar;
        m_tabBar = NULL;

        createTabTree();
        for (int i = 0; i < tabs.size(); ++i)
            m_tabTree->insertTab(tabs[i], i, i == 0);
    } else {
        delete m_tabTree;
        m_tabTree = NULL;

        createTabBar();
        for (int i = 0; i < tabs.size(); ++i)
            m_tabBar->insertTab(i, tabs[i]);
    }
}
PropertiesDialog::PropertiesDialog(QWidget * parent)
:QDialog(parent)
{

	createCoverBox();
    createGeneralInfoBox();
    createAuthorsBox();
	createPublishingBox();
	createButtonBox();
	createPlotBox();

	createTabBar();

	mainLayout = new QGridLayout;
	//mainLayout->addWidget(coverBox,0,0);
	mainLayout->addWidget(tabBar,0,1);
	mainLayout->setColumnStretch(1,1);
	/*mainLayout->addWidget(authorsBox,1,1);
	mainLayout->addWidget(publishingBox,2,1);*/
	mainLayout->addWidget(buttonBox,1,1,Qt::AlignBottom);

	mainWidget = new QWidget(this);
	mainWidget->setAutoFillBackground(true);
	mainWidget->setFixedSize(470,444);
	mainWidget->setLayout(mainLayout);
	mainLayout->setSizeConstraint(QLayout::SetMinimumSize);

	int heightDesktopResolution = QApplication::desktop()->screenGeometry().height();
	int widthDesktopResolution = QApplication::desktop()->screenGeometry().width();
	int sHeight,sWidth;
	sHeight = static_cast<int>(heightDesktopResolution*0.65);
	sWidth = static_cast<int>(sHeight*1.4);
	//setCover(QPixmap(":/images/notCover.png"));

	this->move(QPoint((widthDesktopResolution-sWidth)/2,((heightDesktopResolution-sHeight)-40)/2));
	setModal(true);

	setFixedSize( sizeHint() );
	mainWidget->move(280,0);
}