本文整理汇总了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);
}
示例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);
});
}
示例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&)));
}
示例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)
{
//.........这里部分代码省略.........