本文整理汇总了C++中QStackedLayout::addWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ QStackedLayout::addWidget方法的具体用法?C++ QStackedLayout::addWidget怎么用?C++ QStackedLayout::addWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStackedLayout
的用法示例。
在下文中一共展示了QStackedLayout::addWidget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: pixmap
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);
}
示例3: 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);
}
示例4: 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]
}
示例5: 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()));
}
示例6: 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);
}
示例7: pixmap
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
}
示例8: 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);
});
}
示例9: 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&)));
}
示例10: createLayout
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);
}
示例11: addSensor
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;
}
示例12: SIPLong_FromLong
static PyObject *meth_QStackedLayout_addWidget(PyObject *sipSelf, PyObject *sipArgs)
{
PyObject *sipParseErr = NULL;
{
QWidget* a0;
PyObject *a0Wrapper;
QStackedLayout *sipCpp;
if (sipParseArgs(&sipParseErr, sipArgs, "[email protected]", &sipSelf, sipType_QStackedLayout, &sipCpp, &a0Wrapper, sipType_QWidget, &a0))
{
int sipRes = 0;
#line 50 "/Users/Kunwiji/Dropbox/Spectroscopy_paper/PyQt-mac-gpl-4.11.2/sip/QtGui/qstackedlayout.sip"
Py_BEGIN_ALLOW_THREADS
sipCpp->addWidget(a0);
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(a0Wrapper, py_parent);
}
else
{
// For now give the Python ownership to the layout. This maintains
// compatibility with previous versions and allows addWidget(QWidget()).
sipTransferTo(a0Wrapper, sipSelf);
}
#line 653 "/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_addWidget, doc_QStackedLayout_addWidget);
return NULL;
}
示例13: 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);
}
示例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: setupGui
void MainWindow::setupGui()
{
QWidget* centralWidget = NULL;
#ifdef USE_OPENGL_RENDER
if(player() && player()->isSupportOpenGL() && m_opengl_enabled)
{
bool opengl_windget_created = false;
do {
// Enable OpenGL render
centralWidget = new OpenGLWidgetContainer;
QOpenGLWidget* opengl_widget = dynamic_cast<QOpenGLWidget*>(centralWidget);
if(!opengl_widget)
{
WARN() << "OpenGL widget not created!";
break;
}
QOpenGLContext* opengl_context = opengl_widget->context();
if(!opengl_context)
{
WARN() << "Invalid OpenGL context!";
break;
}
QPair<int,int> opengl_version = opengl_context->format().version();
if(!opengl_widget->isValid() || opengl_version.first < 2) // Disable OpenGL for virtualbox
{
WARN() << "Invalid OpenGL version!";
break;
}
} while(false);
if(!opengl_windget_created)
{
WARN() << "Can't instantinate OpenGL widget. Falling back to QWidget";
delete centralWidget;
centralWidget = new QWidget(this);
}
}
else
{
DEBUG() << "OpenGL is disabled or player doesn't support OpenGL rendering. Creating a QWidget renderer";
centralWidget = new QWidget(this);
}
#else
centralWidget = new QWidget(this);
#endif //USE_OPENGL_RENDER
QStackedLayout* stackedLayout = new QStackedLayout;
stackedLayout->setObjectName("stackedLayout");
centralWidget->setLayout(stackedLayout);
//centralWidget->setAttribute(Qt::WA_TransparentForMouseEvents, true);
this->setCentralWidget(centralWidget);
if(browser())
{
browser()->setParentWidget(centralWidget);
browser()->setLayout(stackedLayout);
browser()->createNewPage();
}
else
WARN() << "Browser plugin not found! The app may not work correctly!";
if(player() != NULL && player()->isInitialized())
{
player()->setAspectRatio(SDK::ASPECT_RATIO_AUTO);
player()->widget()->setParent(centralWidget);
stackedLayout->addWidget(player()->widget());
player()->show();
}
else
WARN() << "No mediplayer plugin found. Media will be disabled!";
gui()->setTopWidget(SDK::GUI::TOP_WIDGET_BROWSER);
setMouseTracking(true);
resizeWebView();
for(QObject* widget: centralWidget->children())
{
DEBUG() << "Stack child" << widget;
}
}