本文整理汇总了C++中QSizePolicy::setVerticalPolicy方法的典型用法代码示例。如果您正苦于以下问题:C++ QSizePolicy::setVerticalPolicy方法的具体用法?C++ QSizePolicy::setVerticalPolicy怎么用?C++ QSizePolicy::setVerticalPolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSizePolicy
的用法示例。
在下文中一共展示了QSizePolicy::setVerticalPolicy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generateWidget
void BaseOrdinalPropertyWidgetQt::generateWidget() {
signalMapperSetPropertyValue_ = new QSignalMapper(this);
signalMapperContextMenu_ = new QSignalMapper(this);
QHBoxLayout* hLayout = new QHBoxLayout();
hLayout->setContentsMargins(0,0,0,0);
hLayout->setSpacing(7);
label_ = new EditableLabelQt(this, property_);
hLayout->addWidget(label_);
QWidget* sliderWidget = new QWidget();
sliderWidgets_ = makeSliders(sliderWidget);
for(size_t i = 0; i < sliderWidgets_.size(); i++) {
sliderWidgets_[i]->setContextMenuPolicy(Qt::CustomContextMenu);
connect(sliderWidgets_[i],
SIGNAL(customContextMenuRequested(const QPoint&)),
signalMapperContextMenu_,
SLOT(map()));
connect(sliderWidgets_[i],
SIGNAL(valueChanged()),
signalMapperSetPropertyValue_,
SLOT(map()));
signalMapperContextMenu_->setMapping(sliderWidgets_[i], static_cast<int>(i));
signalMapperSetPropertyValue_->setMapping(sliderWidgets_[i], static_cast<int>(i));
}
hLayout->addWidget(sliderWidget);
sliderWidget->setMinimumHeight(sliderWidget->sizeHint().height());
QSizePolicy sp = sliderWidget->sizePolicy();
sp.setVerticalPolicy(QSizePolicy::Fixed);
sliderWidget->setSizePolicy(sp);
connect(signalMapperContextMenu_,
SIGNAL(mapped(int)),
this,
SLOT(showContextMenuSlider(int)));
connect(signalMapperSetPropertyValue_,
SIGNAL(mapped(int)),
this,
SLOT(setPropertyValue(int)));
setLayout(hLayout);
setFixedHeight(sizeHint().height());
sp = sizePolicy();
sp.setVerticalPolicy(QSizePolicy::Fixed);
setSizePolicy(sp);
}
示例2: buildGUI
QWidget* QCamAutoAlign::buildGUI(QWidget * parent) {
QSizePolicy sizePolicyMax;
sizePolicyMax.setVerticalPolicy(QSizePolicy::Expanding);
sizePolicyMax.setHorizontalPolicy(QSizePolicy::Expanding);
QSizePolicy sizePolicyMin;
sizePolicyMin.setVerticalPolicy(QSizePolicy::Minimum);
sizePolicyMin.setHorizontalPolicy(QSizePolicy::Minimum);
QWidget* remoteCTRL= QCam::buildGUI(parent);
QCamUtilities::registerWidget(remoteCTRL);
QPushButton* resetCenter = new QPushButton(tr("reset"),remoteCTRL);
connect(resetCenter,SIGNAL(pressed()),this,SLOT(reset()));
findShiftWidget_=new QCamHGroupBox(tr("Find Shift Ctrl"),remoteCTRL);
if (tracker_) {
findShiftCtrl_=tracker_->buildGUI(findShiftWidget_);
}
cropSlider_=new QCamSlider(tr("crop"),false,remoteCTRL,1,100);
cropSlider_->setSizePolicy(sizePolicyMin);
connect(cropSlider_, SIGNAL(valueChange(int)),
this,SLOT(setCropValue(int)));
cropSlider_->setValue((int)round(cropValue_*100));
cropSlider_->setToolTip(tr("% of image to keep when crooping"));
centerButton_=new QCheckBox(tr("Center image"),remoteCTRL);
connect(centerButton_,SIGNAL(toggled(bool)),this,SLOT(setImageCenter(bool)));
centerButton_->setToolTip(tr("Center shifted images on the center of the frame"));
#if ONE_MAP
scaleSlider_=new QCamSlider(tr("Display scale"),false,remoteCTRL,1,100);
scaleSlider_->setSizePolicy(sizePolicyMin);
scaleSlider_->setToolTip(tr("Scale of the shift history Map"));
shiftMap_= new QVectorMap(remoteCTRL);
shiftMap_->setSizePolicy(sizePolicyMax);
shiftMap_->setMode(DrawLine);
connect(scaleSlider_, SIGNAL(valueChange(int)),shiftMap_,SLOT(setScale(int)));
shiftMap_->setToolTip(tr("Show the history of the frame shift"));
#else
shiftXhisto_ = new QHistogram(remoteCTRL);
shiftXhisto_->setDataSize(200);
shiftXhisto_->setAutoShift(true);
shiftXhisto_->setAverage(4);
shiftYhisto_ = new QHistogram(remoteCTRL);
shiftYhisto_->setDataSize(200);
shiftYhisto_->setAutoShift(true);
shiftYhisto_->setAverage(4);
#endif
resetCenter->show();
return remoteCTRL;
}
示例3: myPalette
ChatWidget::ChatWidget(QWidget *parent) : QScrollArea(parent), ui(new Ui::ChatWidget) {
ui->setupUi(this);
this->setVerticalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOn);
this->setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAsNeeded);
QSizePolicy selfSizePolicy = this->sizePolicy();
selfSizePolicy.setHeightForWidth(true);
this->setSizePolicy(selfSizePolicy);
this->setWidgetResizable(true);
QSizePolicy contentsSizePolicy = ui->scrollAreaWidgetContents->sizePolicy();
contentsSizePolicy.setHorizontalPolicy(QSizePolicy::Expanding);
contentsSizePolicy.setVerticalPolicy(QSizePolicy::Expanding);
contentsSizePolicy.setHeightForWidth(true);
ui->scrollAreaWidgetContents->setSizePolicy(contentsSizePolicy);
ui->scrollAreaWidgetContents->setMinimumWidth(400);
this->setWidget(ui->scrollAreaWidgetContents);
topLayout = new QVBoxLayout();
ui->scrollAreaWidgetContents->setLayout(topLayout);
QPalette myPalette(palette());
myPalette.setColor(QPalette::Background, Qt::white);
this->setAutoFillBackground(true);
this->setPalette(myPalette);
}
示例4: setup_ui
void EditorMultiLineInputDialog::setup_ui()
{
QSizePolicy sizePolicy;
sizePolicy.setHorizontalPolicy(QSizePolicy::Expanding);
sizePolicy.setVerticalPolicy(QSizePolicy::Expanding);
textArea=new QTextEdit(this);
textArea->setAcceptRichText(false);
textArea->setSizePolicy(sizePolicy);
buttonBox=new QDialogButtonBox(Qt::Horizontal);
buttonBox->addButton(tr("OK"),QDialogButtonBox::AcceptRole);
buttonBox->addButton(tr("Cancel"),QDialogButtonBox::RejectRole);
// Устанавливается размер окна, равныи виджету, из которого
// этот виджет был вызван
if(this->parent()->isWidgetType())
{
QWidget *parentWidget=qobject_cast<QWidget *>(this->parent());
QRect geom(parentWidget->pos(), parentWidget->size());
qDebug() << "Parent window geometry " << geom.x() << geom.y() << geom.width() << geom.height();
setMinimumSize(parentWidget->size());
}
}
示例5: generateWidget
void StringMultilinePropertyWidgetQt::generateWidget() {
QHBoxLayout *hLayout = new QHBoxLayout;
setSpacingAndMargins(hLayout);
// QVBoxLayout* vLayout = new QVBoxLayout;
// vLayout->setContentsMargins(0, 0, 0, 0);
// vLayout->setSpacing(0);
label_ = new EditableLabelQt(this, property_);
// vLayout->addWidget(label_);
// vLayout->addStretch();
// hLayout->addLayout(vLayout);
hLayout->addWidget(label_);
textEdit_ = new MultilineTextEdit;
// if(property_->getSemantics().getString() == "Password"){
// textEdit_->setEchoMode(QLineEdit::PasswordEchoOnEdit);
//}
QSizePolicy sp = textEdit_->sizePolicy();
sp.setHorizontalStretch(3);
sp.setVerticalPolicy(QSizePolicy::Preferred);
textEdit_->setSizePolicy(sp);
hLayout->addWidget(textEdit_);
setLayout(hLayout);
connect(textEdit_, SIGNAL(editingFinished()), this, SLOT(setPropertyValue()));
}
示例6: QMainWindow
pictoController::pictoController(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::pictoController){
ui->setupUi(this);
subwidget = new subWidget();
subwidget->setWindowTitle("subWidget");
QSizePolicy policy;
policy.setVerticalPolicy(QSizePolicy::Fixed);
policy.setHorizontalPolicy(QSizePolicy::Fixed);
subwidget->setSizePolicy(policy);
subwidget->setFixedSize(385,216);
ui->gridLayout_3->addWidget(subwidget, 0, 2, 1, 1);
move(1300,0);
//preset tab settings
ui->tableWidget->setColumnWidth(0, 300);
QFont font;
font.setPointSize(7);
font.setFamily("MS UI Gothic");
font.setBold(true);
ui->tableWidget->horizontalHeader()->setFont(font);
//ui->tableWidget->horizontalHeaderItem(1)->setFlags(Qt::ItemFlag::);
}
示例7: ui
SettingsWidget::SettingsWidget()
: ui(new Ui::SettingsWidget)
{
ui->setupUi(this);
QSizePolicy policy = ui->answersList->sizePolicy();
policy.setVerticalPolicy(QSizePolicy::MinimumExpanding);
ui->answersList->setSizePolicy(policy);
listenChildrenStates(QWidgetList() << ui->answersList);
}
示例8: QWebView
MapWidget::MapWidget(QWidget* parent) : QWebView(parent)
{
mapPage = new MapPage(this);
this->setPage(mapPage);
createActions();
QSizePolicy policy = this->sizePolicy();
policy.setVerticalPolicy(QSizePolicy::Expanding);
this->setSizePolicy(policy);
}
示例9: viewServerLogToggled
void OpenconnectAuthWidget::viewServerLogToggled(bool toggled)
{
Q_D(OpenconnectAuthWidget);
d->ui.lblLogLevel->setVisible(toggled);
d->ui.cmbLogLevel->setVisible(toggled);
if (toggled) {
delete d->ui.verticalLayout->takeAt(5);
QSizePolicy policy = d->ui.serverLogBox->sizePolicy();
policy.setVerticalPolicy(QSizePolicy::Expanding);
d->ui.serverLogBox->setSizePolicy(policy);
d->ui.serverLog->setVisible(true);
} else {
QSpacerItem *verticalSpacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
d->ui.verticalLayout->addItem(verticalSpacer);
d->ui.serverLog->setVisible(false);
QSizePolicy policy = d->ui.serverLogBox->sizePolicy();
policy.setVerticalPolicy(QSizePolicy::Fixed);
d->ui.serverLogBox->setSizePolicy(policy);
}
}
示例10: QWidget
QRcodeWidget::QRcodeWidget(QWidget *parent) :
QWidget(parent)
{
QSizePolicy sizePolicy;
sizePolicy.setHorizontalPolicy(QSizePolicy::Fixed);
sizePolicy.setVerticalPolicy(QSizePolicy::Fixed);
this->setSizePolicy(sizePolicy);
this->resize(QSize(200, 200));
this->setMinimumSize(this->size());
code = NULL;
}
示例11: updateParts
void QtnPropertyWidget::updateParts()
{
// clear layout
while (!m_layout->isEmpty())
m_layout->takeAt(0);
// check toolbar
// check description panel
if (m_parts & QtnPropertyWidgetPartsDescriptionPanel)
{
if (!m_descriptionSplitter)
{
// create splitter
Q_ASSERT(!m_descriptionPanel);
QSplitter* splitter = new QSplitter(Qt::Vertical, this);
// add property view
splitter->addWidget(m_propertyView);
// create description panel
m_descriptionPanel = new QLabel(splitter);
m_descriptionPanel->setTextFormat(Qt::RichText);
m_descriptionPanel->setAlignment(Qt::AlignTop);
m_descriptionPanel->setWordWrap(true);
m_descriptionPanel->setFrameStyle(QFrame::Box | QFrame::Sunken);
m_descriptionPanel->setMinimumSize(0, 0);
QSizePolicy p = m_descriptionPanel->sizePolicy();
p.setVerticalPolicy(QSizePolicy::Ignored);
p.setHorizontalPolicy(QSizePolicy::Ignored);
m_descriptionPanel->setSizePolicy(p);
// setup DblClick handler
splitter->handle(1)->installEventFilter(new QtnSplitterEventsHandler(splitter));
m_descriptionSplitter = splitter;
}
m_layout->addWidget(m_descriptionSplitter);
}
else
{
if (m_descriptionSplitter)
{
delete m_descriptionSplitter;
m_descriptionSplitter = nullptr;
m_descriptionPanel = nullptr;
}
m_layout->addWidget(m_propertyView);
}
}
示例12: addWidget
/*! \internal
Adds a widget to the scroll bar container.
*/
void QAbstractScrollAreaScrollBarContainer::addWidget(QWidget *widget, LogicalPosition position)
{
QSizePolicy policy = widget->sizePolicy();
if (orientation == Qt::Vertical)
policy.setHorizontalPolicy(QSizePolicy::Ignored);
else
policy.setVerticalPolicy(QSizePolicy::Ignored);
widget->setSizePolicy(policy);
widget->setParent(this);
const int insertIndex = (position & LogicalLeft) ? 0 : scrollBarLayoutIndex() + 1;
layout->insertWidget(insertIndex, widget);
}
示例13: QColor
LineCbBox::LineCbBox(QWidget *pParent)
:QComboBox(pParent)
{
setParent(pParent);
m_Style = 0;
m_Width = 1;
m_Color = QColor(255,100,50);
QSizePolicy szPolicyExpanding;
szPolicyExpanding.setHorizontalPolicy(QSizePolicy::MinimumExpanding);
szPolicyExpanding.setVerticalPolicy(QSizePolicy::Minimum);
setSizePolicy(szPolicyExpanding);
}
示例14: QWidget
OutputPanePlaceHolder::OutputPanePlaceHolder(Core::IMode *mode, QSplitter* parent)
: QWidget(parent), m_mode(mode), m_closeable(true)
{
m_splitter = parent;
setVisible(false);
setLayout(new QVBoxLayout);
QSizePolicy sp;
sp.setHorizontalPolicy(QSizePolicy::Preferred);
sp.setVerticalPolicy(QSizePolicy::Preferred);
sp.setHorizontalStretch(0);
setSizePolicy(sp);
layout()->setMargin(0);
connect(Core::ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode *)),
this, SLOT(currentModeChanged(Core::IMode *)));
}
示例15: QWidget
CalculatorWidget::CalculatorWidget(QWidget *parent, Qt::WindowFlags flags) : QWidget(parent, flags) {
QGridLayout *layout = new QGridLayout(this);
layout->setSizeConstraint(QLayout::SetFixedSize);
setLayout(layout);
QSizePolicy policy = sizePolicy();
displayLabel = new QLabel(this);
layout->addWidget(displayLabel, 0, 0, 1, 3);
displayLabel->setAutoFillBackground(true);
displayLabel->setBackgroundRole(QPalette::Base);
displayLabel->setAlignment(Qt::AlignRight);
displayLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
policy = displayLabel->sizePolicy();
policy.setVerticalPolicy(QSizePolicy::Fixed);
displayLabel->setSizePolicy(policy);
signalMapper = new QSignalMapper(this);
QPushButton *button = new QPushButton(QString::number(0), this);
QObject::connect(button, SIGNAL(clicked()), signalMapper, SLOT(map()));
signalMapper->setMapping(button, 0);
layout->addWidget(button, 4, 1);
digitButtons.push_back(button);
for (unsigned int i = 1; i < 10; ++i) {
QPushButton *button = new QPushButton(QString::number(i), this);
QObject::connect(button, SIGNAL(clicked()), signalMapper, SLOT(map()));
signalMapper->setMapping(button, i);
layout->addWidget(button, 1+(9-i)/3, (i-1)%3);
digitButtons.push_back(button);
}
QObject::connect(signalMapper, SIGNAL(mapped(int)), SLOT(buttonClicked(int)));
clearButton = new QPushButton("C", this);
layout->addWidget(clearButton, 1, 4);
QObject::connect(clearButton, SIGNAL(clicked()), SLOT(clearButtonClicked()));
additionButton = new QPushButton("+", this);
layout->addWidget(additionButton, 2, 4);
QObject::connect(additionButton, SIGNAL(clicked()), SLOT(addButtonClicked()));
subtractionButton = new QPushButton("-", this);
layout->addWidget(subtractionButton, 3, 4);
QObject::connect(subtractionButton, SIGNAL(clicked()), SLOT(subtractButtonClicked()));
calculateButton = new QPushButton("=", this);
layout->addWidget(calculateButton, 4, 4);
QObject::connect(calculateButton, SIGNAL(clicked()), SLOT(calculateButtonClicked()));
}