本文整理汇总了C++中QStackedLayout类的典型用法代码示例。如果您正苦于以下问题:C++ QStackedLayout类的具体用法?C++ QStackedLayout怎么用?C++ QStackedLayout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QStackedLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
Widget::Widget(QWidget *parent)
: QWidget(parent)
{
//! [0]
QWidget *firstPageWidget = new QWidget;
QWidget *secondPageWidget = new QWidget;
QWidget *thirdPageWidget = new QWidget;
QStackedLayout *stackedLayout = new QStackedLayout;
stackedLayout->addWidget(firstPageWidget);
stackedLayout->addWidget(secondPageWidget);
stackedLayout->addWidget(thirdPageWidget);
//! [0] //! [1]
QComboBox *pageComboBox = new QComboBox;
pageComboBox->addItem(tr("Page 1"));
pageComboBox->addItem(tr("Page 2"));
pageComboBox->addItem(tr("Page 3"));
connect(pageComboBox, SIGNAL(activated(int)),
stackedLayout, SLOT(setCurrentIndex(int)));
//! [1]
//! [2]
QVBoxLayout *mainLayout = new QVBoxLayout;
//! [2]
mainLayout->addWidget(pageComboBox);
//! [3]
mainLayout->addLayout(stackedLayout);
setLayout(mainLayout);
//! [3]
}
示例2: QDialog
EventDetailsDialog::EventDetailsDialog(const SeafEvent& event, QWidget *parent)
: QDialog(parent),
event_(event)
{
setWindowTitle(tr("Modification Details"));
setWindowIcon(QIcon(":/images/seafile.png"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QStackedLayout *layout = new QStackedLayout;
layout->setContentsMargins(0, 0, 0, 0);
setLayout(layout);
loading_view_ = new LoadingView;
layout->addWidget(loading_view_);
tree_ = new EventDetailsListView(event);
model_ = new EventDetailsListModel(event);
tree_->setModel(model_);
layout->addWidget(tree_);
request_ = 0;
sendRequest();
}
示例3: updateContent
void EventDetailsDialog::updateContent(const CommitDetails& details)
{
QStackedLayout *layout = (QStackedLayout *)this->layout();
layout->setCurrentIndex(INDEX_DETAILS_VIEW);
model_->setCommitDetails(details);
}
示例4: QWidget
CloudView::CloudView(QWidget *parent)
: QWidget(parent),
in_refresh_(false),
list_repo_req_(NULL)
{
repos_list_ = new ServerReposListView;
repos_model_ = new ServerReposListModel;
repos_list_->setModel(repos_model_);
createLoadingView();
QStackedLayout *stack = new QStackedLayout;
stack->insertWidget(INDEX_LOADING_VIEW, loading_view_);
stack->insertWidget(INDEX_REPOS_LIST, repos_list_);
setLayout(stack);
prepareAccountButtonMenu();
refresh_timer_ = new QTimer(this);
connect(refresh_timer_, SIGNAL(timeout()), this, SLOT(refreshRepos()));
connect(seafApplet->accountManager(), SIGNAL(accountAdded(const Account&)),
this, SLOT(setCurrentAccount(const Account&)));
connect(seafApplet->accountManager(), SIGNAL(accountAdded(const Account&)),
this, SLOT(updateAccountMenu()));
connect(seafApplet->accountManager(), SIGNAL(accountRemoved(const Account&)),
this, SLOT(updateAccountMenu()));
}
示例5: QWidget
QHelpBox::QHelpBox(QWidget *_parent) : QWidget(_parent)
{
defaultMsg = "";
parent = _parent;
helpBox = new QLabel();
helpBox->setStyleSheet("border: 1px solid; border-color: rgb(71,127,249); background-color: rgb(245,245,245); margin-top:0px; "
"margin-bottom:0px; margin-left: 0px; padding-right: 4px; padding-top:2px; padding-bottom:2px; padding-left:60px; text-align:justify;"
"");
helpBox->setWordWrap(true);
QFont tinyFont = QApplication::font();
#if defined Q_OS_WIN
tinyFont.setPointSize(7);
#endif
helpBox->setFont(tinyFont);
QPixmap pixmap(":/icons/help.png");
helpIcon = new QLabel();
helpIcon->setPixmap(pixmap.scaled(35,35, Qt::KeepAspectRatio, Qt::SmoothTransformation));
helpIcon->setStyleSheet("margin-left: 10px");
QStackedLayout *helpLayout = new QStackedLayout();
helpLayout->addWidget(helpBox);
helpLayout->addWidget(helpIcon);
helpLayout->setStackingMode(QStackedLayout::StackAll);
setLayout(helpLayout);
}
示例6: changeMainView
void MainWindow::changeMainView(QWidget *newWidget)
{
QStackedLayout *mainLayout = (QStackedLayout *)ui->mainWidget->layout();
if (mainLayout->currentWidget() == settingWidget)
{
mpdCommand->updateConnection();
}
mainLayout->setCurrentWidget(newWidget);
}
示例7: QMainWindow
////public////
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent,Qt::FramelessWindowHint)
{
// this->setAutoFillBackground(true);
// QPalette palette;
// QPixmap pixmap(":/images/dialogbackground.jpg");
// palette.setBrush(QPalette::Window, QBrush(pixmap));
// this->setPalette(palette);
this->setWindowIcon(QIcon(":./iamges/window.icon"));
this->setAttribute(Qt::WA_TranslucentBackground);
arcR=10;
centralwidget=new CentralWidget(this);
play_label=new PlayLabel(centralwidget);
player = new SimPlayer;
contralwidget=new ContralWidget(this,player);
// contralwidget->setMainWindow(this);
play_label->setPlayer(player);
//////////////////////////////////////////////////布局
// this->setCentralWidget(centralwidget);
QStackedLayout *stack =new QStackedLayout;
stack->setStackingMode(QStackedLayout::StackAll);
stack->addWidget(play_label);
stack->addWidget(contralwidget);
// play_label->show();
centralwidget->setLayout(stack);
this->setGeometry(100,100,760,460);
BaseSetting::readSettings();
centralwidget->setGeometry(0,0,this->width()-15,this->height()-15);
HideSDLWindow(); //先设置好这个,再创建线程
connect(player,SIGNAL(display()),play_label,SLOT(display()));
}
示例8: sipGetPyObject
static PyObject *meth_QStackedLayout_insertWidget(PyObject *sipSelf, PyObject *sipArgs)
{
PyObject *sipParseErr = NULL;
{
int a0;
QWidget* a1;
PyObject *a1Wrapper;
QStackedLayout *sipCpp;
if (sipParseArgs(&sipParseErr, sipArgs, "[email protected]", &sipSelf, sipType_QStackedLayout, &sipCpp, &a0, &a1Wrapper, sipType_QWidget, &a1))
{
int sipRes = 0;
#line 74 "/Users/Kunwiji/Dropbox/Spectroscopy_paper/PyQt-mac-gpl-4.11.2/sip/QtGui/qstackedlayout.sip"
Py_BEGIN_ALLOW_THREADS
sipCpp->insertWidget(a0, a1);
Py_END_ALLOW_THREADS
// The layout's parent widget (if there is one) will now have ownership.
QWidget *parent = sipCpp->parentWidget();
if (parent)
{
PyObject *py_parent = sipGetPyObject(parent, sipType_QWidget);
if (py_parent)
sipTransferTo(a1Wrapper, py_parent);
}
else
{
// For now give the Python ownership to the layout. This maintains
// compatibility with previous versions and allows insertWidget(QWidget()).
sipTransferTo(a1Wrapper, sipSelf);
}
#line 704 "/Users/Kunwiji/Dropbox/Spectroscopy_paper/PyQt-mac-gpl-4.11.2/QtGui/sipQtGuiQStackedLayout.cpp"
return SIPLong_FromLong(sipRes);
}
}
/* Raise an exception if the arguments couldn't be parsed. */
sipNoMethod(sipParseErr, sipName_QStackedLayout, sipName_insertWidget, doc_QStackedLayout_insertWidget);
return NULL;
}
示例9: QStackedLayout
bool ProcessController::addSensor(const QString& hostName,
const QString& sensorName,
const QString& sensorType,
const QString& title)
{
if (sensorType != "table")
return false;
QStackedLayout *layout = new QStackedLayout(this);
mProcessList = new KSysGuardProcessList(this, hostName);
mProcessList->setUpdateIntervalMSecs(0); //we will call updateList() manually
mProcessList->setContentsMargins(0,0,0,0);
mProcessList->setScriptingEnabled(true);
addActions(mProcessList->actions());
connect(mProcessList, &KSysGuardProcessList::updated, this, &ProcessController::updated);
connect(mProcessList, &KSysGuardProcessList::processListChanged, this, &ProcessController::processListChanged);
mProcessList->setContextMenuPolicy( Qt::CustomContextMenu );
connect(mProcessList, &KSysGuardProcessList::customContextMenuRequested, this, &ProcessController::showContextMenu);
layout->addWidget(mProcessList);
/** To use a remote sensor, we need to drill down through the layers, to connect to the remote processes. Then connect to its signals and slots.
* It's horrible I know :( */
if(!hostName.isEmpty() && hostName != "localhost") {
KSysGuard::Processes *processes = mProcessList->processModel()->processController();
mProcesses = processes;
if(processes) {
connect(processes, &KSysGuard::Processes::runCommand, this, &ProcessController::runCommand);
}
}
setPlotterWidget(mProcessList);
QTimer::singleShot(0, mProcessList->filterLineEdit(), SLOT(setFocus()));
registerSensor(new KSGRD::SensorProperties(hostName, sensorName, sensorType, title));
/* This just triggers the first communication. The full set of
* requests are send whenever the sensor reconnects (detected in
* sensorError(). */
sensors().at(0)->setIsOk(true); //Assume it is okay from the start
setSensorOk(sensors().at(0)->isOk());
emit processListChanged();
return true;
}
示例10: QWidget
QHelpBox::QHelpBox(QWidget *_parent) : QWidget(_parent)
{
parent = _parent;
backgroundPanel = new QLabel();
backgroundPanel->setStyleSheet("border: 1px solid; border-color: rgb(71,127,249); background-color: rgb(245,245,245); margin-top:0px; "
"margin-bottom:0px; margin-left: 0px; padding-right: 4px; padding-top:4px; padding-bottom:4px; padding-left:60px;"
"");
helpBox = new QLabel();
#ifdef Q_OS_LINUX
QFont tinyFont = QApplication::font();
tinyFont.setPointSize(9);
helpBox->setFont(tinyFont);
#endif
helpBox->setStyleSheet("margin-top:0px; margin-bottom:0px; margin-left: 0px; padding-right: 4px; padding-top:4px; padding-bottom:4px; padding-left:60px; text-align:justify;");
helpBox->setWordWrap(true);
helpBox->setTextFormat(Qt::RichText);
helpBox->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
helpBox->setOpenExternalLinks(true);
QPixmap pixmap(":/icons/help2.png");
helpIcon = new QLabel();
helpIcon->setPixmap(pixmap.scaled(50,50, Qt::KeepAspectRatio, Qt::SmoothTransformation));
helpIcon->setStyleSheet("margin-left: 5px");
QStackedLayout *helpLayout = new QStackedLayout();
helpLayout->addWidget(backgroundPanel);
helpLayout->addWidget(helpIcon);
helpLayout->addWidget(helpBox);
helpLayout->setStackingMode(QStackedLayout::StackAll);
setLayout(helpLayout);
#ifdef Q_OS_MAC
this->setFixedHeight(90);
#endif
#ifdef Q_OS_WIN32
this->setFixedHeight(120);
#endif
#ifdef Q_OS_LINUX
this->setFixedHeight(120);
#endif
}
示例11: QDialog
SigalDialog::SigalDialog(int isright,QString filename, RTFDocument *doc, QWidget *parent):
QDialog(parent),
ui(new Ui::SigalDialog)
{
ui->setupUi(this);
this->isright = isright;
this->doc = doc;
QStackedLayout *layout = new QStackedLayout(ui->ImageContainer);
this->label = new ClickLabel(isright,filename,doc,this);
layout->addWidget(label);
// /label->setPixmap(QPixmap(filename));
this->setWindowFlags(Qt::Dialog
|Qt::WindowMaximizeButtonHint
|Qt::WindowMinimizeButtonHint
|Qt::WindowCloseButtonHint);
this->showMaximized();
ui->okBut->setEnabled(false);
}
示例12: QDialog
SettingDialog::SettingDialog(QWidget *parent):
QDialog(parent)
// , m_settingLayout(new QVBoxLayout(this))
// , m_stackedWidget(new QStackedWidget)
// , m_okBtn(new QPushButton(this))
{
this->setWindowFlags(Qt::FramelessWindowHint);
this->setFixedSize(479, 421);
this->setFocusPolicy(Qt::ClickFocus);
this->setWindowTitle(tr("Kylin Weather - Setting"));
this->setWindowIcon(QIcon(":/res/indicator-china-weather.png"));
//Why????? setStyleSheet将导致添加城市后,列表没有自动拉伸,出现重叠,但是qDebug打印的高度确实增加了,但是使用paintEvent可以
//this->setStyleSheet("QDialog{border:1px solid #000000;border-radius:2px;background:rgba(255, 255, 255, 0.7);}QDialog:hover{background: rgba(255, 255, 255, 1.0);}");
initSettings();
initSearch();
QStackedLayout *contentLayout = new QStackedLayout(this);
contentLayout->setContentsMargins(20, 20, 20, 20);
contentLayout->setMargin(0);
contentLayout->setSpacing(0);
contentLayout->addWidget(m_settingFrame);
contentLayout->addWidget(m_searchFrame);
m_settingFrame->setVisible(true);
}
示例13: connect
void MainWindow::createLayout() {
QGridLayout *topLayout = new QGridLayout;
topLayout->addWidget(inputFileListLabel, 0, 0, 1, 1);
topLayout->addWidget(inputFileListLineEdit, 0, 1, 1, 1);
topLayout->addWidget(resultFileLabel, 1, 0, 1, 1);
topLayout->addWidget(resultFileLineEdit, 1, 1, 1, 1);
QStackedLayout *stackedLayout = new QStackedLayout;
stackedLayout->addWidget(helium3Widget);
stackedLayout->addWidget(antiHelium3Widget);
stackedLayout->addWidget(hypertritonWidget);
stackedLayout->addWidget(antiHypertritonWidget);
connect(listWidget, &QListWidget::currentRowChanged, stackedLayout, &QStackedLayout::setCurrentIndex);
listWidget->setCurrentRow(0);
QGridLayout *middleLayout = new QGridLayout;
middleLayout->addWidget(listWidget, 0, 0, 1, 1);
middleLayout->addLayout(stackedLayout, 0, 1, 1, 1);
middleLayout->setColumnStretch(0, 1);
middleLayout->setColumnStretch(1, 3);
QHBoxLayout *bottomLayout = new QHBoxLayout;
bottomLayout->addStretch();
bottomLayout->addWidget(cancelPushButton);
bottomLayout->addWidget(okPushButton);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addLayout(topLayout);
mainLayout->addLayout(middleLayout);
mainLayout->addLayout(bottomLayout);
centralWidget = new QWidget(this);
centralWidget->setLayout(mainLayout);
this->setCentralWidget(centralWidget);
}
示例14: QWidget
toResultPlanAbstr::toResultPlanAbstr(QWidget *parent)
: QWidget(parent)
, CursorChildSel(NULL)
, DisplayChildCombo(false)
, Explaining(false)
, Query(NULL)
{
using namespace ToConfiguration;
planTreeView = new toResultPlanView(this);
planTreeText = new QPlainTextEdit(this);
planTreeText->setReadOnly(true);
planTreeText->setFont(Utils::toStringToFont(toConfigurationNewSingle::Instance().option(Editor::ConfTextFont).toString()));
//toExplainTypeButtonSingle::Instance().
QStackedLayout *mainLayout = new QStackedLayout;
mainLayout->setSpacing(0);
mainLayout->setContentsMargins(0, 0, 0, 0);
mainLayout->addWidget(planTreeView);
mainLayout->addWidget(planTreeText);
mainLayout->setCurrentIndex(0);
//mainLayout->setStackingMode(QStackedLayout::StackAll);
setLayout(mainLayout);
}
示例15: QWidget
Speed::Speed(QWidget *parent): QWidget(parent)
{
QHBoxLayout *layout = new QHBoxLayout();
layout->setSpacing(0);
layout->setMargin(0);
setStyleSheet("padding: 0;");
QVBoxLayout *contentLayout = new QVBoxLayout();
contentLayout->setSpacing(2);
contentLayout->setMargin(0);
contentLayout->setContentsMargins(0, 2, 0, 0);
QWidget *content = new QWidget();
content->setLayout(contentLayout);
content->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
QStackedLayout *speedometerLayout = new QStackedLayout(contentLayout);
speedometerLayout->setSpacing(2);
speedometerLayout->setMargin(0);
speedometerLayout->setContentsMargins(0, 2, 0, 0);
speedometerLayout->setStackingMode(QStackedLayout::StackAll);
speedometerNeedle = new RotatableImageView(":/resources/speedometer-needle_160x160.png");
speedometerNeedle->rotate(-129);
speedometerLayout->addWidget(speedometerNeedle);
QLabel *speedometer = new QLabel();
speedometer->setPixmap(QPixmap(":/resources/speedometer_160x160.png"));
speedometer->setMargin(2);
speedometerLayout->addWidget(speedometer);
speedometerLabel = new QLabel("N/A");
speedometerLabel->setAlignment(Qt::AlignCenter);
speedometerLabel->setStyleSheet("font: 13pt; font-weight: bold;");
contentLayout->addWidget(speedometerLabel);
TitledBox *box = new TitledBox(tr("Speed"), content);
layout->addWidget(box);
QGraphicsDropShadowEffect *dropShadow = new QGraphicsDropShadowEffect();
dropShadow->setBlurRadius(6);
dropShadow->setColor(QColor(0, 0, 0));
dropShadow->setOffset(0, 0);
setGraphicsEffect(dropShadow);
setLayout(layout);
}