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


C++ QStackedLayout::setCurrentWidget方法代码示例

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


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

示例1: changeMainView

void MainWindow::changeMainView(QWidget *newWidget)
{
    QStackedLayout *mainLayout = (QStackedLayout *)ui->mainWidget->layout();
    if (mainLayout->currentWidget() == settingWidget)
    {
        mpdCommand->updateConnection();
    }

    mainLayout->setCurrentWidget(newWidget);
}
开发者ID:zmyrgel,项目名称:MeegoMPC,代码行数:10,代码来源:mainwindow.cpp

示例2: QObject

WeatherPlugin::WeatherPlugin(QObject *parent)
    : QObject(parent),
      m_view(new QFrame),
      m_requestManager(new WeatherRequest(this))
{
    WeatherWidget *weatherWidget = new WeatherWidget(m_requestManager);
    SetLocationPage *locationPage = new SetLocationPage(m_requestManager);

    QStackedLayout *layout = new QStackedLayout;
    layout->setSpacing(0);
    layout->setMargin(0);

    layout->addWidget(weatherWidget);
    layout->addWidget(locationPage);

    m_view->setLayout(layout);
    m_view->setObjectName("WeatherView");
    m_view->setStyleSheet("#WeatherView {"
                          "background-color: rgba(255, 255, 255, .03);"
                          "}");

    connect(weatherWidget, &WeatherWidget::locationButtonClicked, this, [this, layout, locationPage] {
        locationPage->reset();
        locationPage->setCurrentCity(m_requestManager->city());
        layout->setCurrentWidget(locationPage);
    });

    connect(locationPage, &SetLocationPage::citySet, this, [this, layout, weatherWidget] (const QString &preferredService, const City &city) {
        qDebug() << "set city to " << city.localizedName;
        QList<WeatherItem> empty;
        weatherWidget->refreshView(empty);
        m_requestManager->setPreferredWeatherService(preferredService);
        m_requestManager->setCity(city);
        layout->setCurrentWidget(weatherWidget);
    });

    connect(locationPage, &SetLocationPage::cancelled, this, [=] {
        qDebug() << "cancelled setting city" ;
        layout->setCurrentWidget(weatherWidget);
    });
}
开发者ID:ghj1040110333,项目名称:dde-control-center,代码行数:41,代码来源:weatherplugin.cpp

示例3: QMainWindow

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    settingWidget = new SettingWidget();
    playListWidget = new PlayListWidget();
    nowPlayingWidget = new NowPlayingWidget();
    mediaLibraryWidget = new MediaLibraryWidget();
    mpdCommand = MpdCommand::getInstance();

    QStackedLayout *mainLayout = new QStackedLayout();
    mainLayout->addWidget(settingWidget);
    mainLayout->addWidget(nowPlayingWidget);
    mainLayout->addWidget(playListWidget);
    mainLayout->addWidget(mediaLibraryWidget);
    mainLayout->setCurrentWidget(settingWidget);
    ui->mainWidget->setLayout(mainLayout);

    connect(mpdCommand, SIGNAL(error(int, const QString&)),
            this, SLOT(displayError(int, const QString&)));
}
开发者ID:zmyrgel,项目名称:MeegoMPC,代码行数:22,代码来源:mainwindow.cpp

示例4: volformatChanged

void PConverter::volformatChanged (int )
{
    QComboBox* sender = static_cast<QComboBox*>(QObject::sender());
    QStackedLayout *buttonLayout = 0;
    QPushButton *dirButton = 0;
    QPushButton *fileButton = 0;
    if(sender == outFormatCBox)
    {
        buttonLayout = outButtonLayout;
        dirButton    = outDirButton;
        fileButton   = outFileButton;
    }
    else // both inFormatCBox and timeSeriesCheckBox
    {
        sender = inFormatCBox;
        buttonLayout = inButtonLayout;
        dirButton    = inDirButton;
        fileButton   = inFileButton;
    }

    if(sender->currentText().compare(iim::STACKED_FORMAT.c_str(), Qt::CaseInsensitive) == 0)
    {
        helpBox->setText("Three-leveled (y,x,z) hierarchy of tiles with each tile composed by a series of 2D TIFF files.");
        buttonLayout->setCurrentWidget(dirButton);

        if(sender == outFormatCBox)
            blockDepthField->setVisible(false);
    }
    else if(sender->currentText().compare(iim::SIMPLE_FORMAT.c_str(), Qt::CaseInsensitive) == 0)
    {
        helpBox->setText("A folder containing a series (1+) of 2D TIFF files");
        buttonLayout->setCurrentWidget(dirButton);

        if(sender == outFormatCBox)
            blockDepthField->setVisible(false);
    }
    else if(sender->currentText().compare(iim::TILED_FORMAT.c_str(), Qt::CaseInsensitive) == 0)
    {
        helpBox->setText("Three-leveled (y,x,z) hierarchy of tiles with each tile composed by a series of Vaa3D 3D raw files.");
        buttonLayout->setCurrentWidget(dirButton);

        if(sender == outFormatCBox)
            blockDepthField->setVisible(true);
    }
    else if(sender->currentText().compare(iim::TILED_MC_FORMAT.c_str(), Qt::CaseInsensitive) == 0)
    {
        helpBox->setText("Four-leveled (c,y,x,z) hierarchy of tiles with each tile composed by a series of Vaa3D 3D raw files.");
        buttonLayout->setCurrentWidget(dirButton);

        if(sender == outFormatCBox)
            blockDepthField->setVisible(true);
    }
    else if(sender->currentText().compare(iim::RAW_FORMAT.c_str(), Qt::CaseInsensitive) == 0)
    {
        helpBox->setText("Single Vaa3D 3D raw file");
        if(timeSeriesCheckBox->isChecked())
            buttonLayout->setCurrentWidget(dirButton);
        else
            buttonLayout->setCurrentWidget(fileButton);

        if(sender == outFormatCBox)
            blockDepthField->setVisible(false);
    }
    else if(sender->currentText().compare(iim::SIMPLE_RAW_FORMAT.c_str(), Qt::CaseInsensitive) == 0)
    {
        helpBox->setText("A folder containing a series (1+) of Vaa3D 2D raw files.");
        buttonLayout->setCurrentWidget(dirButton);

        if(sender == outFormatCBox)
            blockDepthField->setVisible(false);
    }
    else if(sender->currentText().compare(iim::TILED_TIF3D_FORMAT.c_str(), Qt::CaseInsensitive) == 0)
    {
        helpBox->setText("Three-leveled (y,x,z) hierarchy of tiles with each tile composed by a series of multipage (3D) TIFF files.");
        buttonLayout->setCurrentWidget(dirButton);

        if(sender == outFormatCBox)
            blockDepthField->setVisible(true);
    }
    else if(sender->currentText().compare(iim::TILED_MC_TIF3D_FORMAT.c_str(), Qt::CaseInsensitive) == 0)
    {
        helpBox->setText("Four-leveled (c,y,x,z) hierarchy of tiles with each tile composed by a series of multipage (3D) TIFF files.");
        buttonLayout->setCurrentWidget(dirButton);

        if(sender == outFormatCBox)
            blockDepthField->setVisible(true);
    }
    else if(sender->currentText().compare(iim::TIF3D_FORMAT.c_str(), Qt::CaseInsensitive) == 0)
    {
        helpBox->setText("A single multipage (3D) TIFF file.");
        if(timeSeriesCheckBox->isChecked())
            buttonLayout->setCurrentWidget(dirButton);
        else
            buttonLayout->setCurrentWidget(fileButton);

        if(sender == outFormatCBox)
            blockDepthField->setVisible(false);
    }
    else if(sender->currentText().compare(iim::BDV_HDF5_FORMAT.c_str(), Qt::CaseInsensitive) == 0)
    {
//.........这里部分代码省略.........
开发者ID:Vaa3D,项目名称:v3d_external,代码行数:101,代码来源:PConverter.cpp


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