本文整理汇总了C++中QScrollArea::setMinimumSize方法的典型用法代码示例。如果您正苦于以下问题:C++ QScrollArea::setMinimumSize方法的具体用法?C++ QScrollArea::setMinimumSize怎么用?C++ QScrollArea::setMinimumSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScrollArea
的用法示例。
在下文中一共展示了QScrollArea::setMinimumSize方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initUI
void QSysMessagePanel::initUI()
{
QWidget *headw = new QWidget(this);
IconButton *closeB = QAppUtils::ref().getCloseIconBtn(headw);
QHBoxLayout *headLay = new QHBoxLayout(headw);
QWidget *center = new QWidget(this);
QWidget *msgWid = new QWidget(center);
QScrollArea *scroll = new QScrollArea(this);
QVBoxLayout *vlay = new QVBoxLayout(this);
QVBoxLayout *vlayMsg = new QVBoxLayout(center);
int width,height;
vlay->setContentsMargins(0,0,0,0);
vlayMsg->addWidget(msgWid);
vlayMsg->addStretch();
QAppUtils::ref().getScreenSize(width,height);
center->setMinimumSize(width/4.1,height/1.3);
scroll->setBackgroundRole(QPalette::Dark);
scroll->setWidget(center);
scroll->setMinimumSize(width/4,height/1.2);
headLay->addStretch();
headLay->addWidget(closeB);
connect(closeB,SIGNAL(clicked()),this,SLOT(close()));
m_lay = new QGridLayout(msgWid);
m_lay->setContentsMargins(0,0,0,0);
vlay->addWidget(headw);
vlay->addWidget(scroll);
vlay->addStretch();
}
示例2: slotSharesFetched
void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>> &shares)
{
QScrollArea *scrollArea = _ui->scrollArea;
auto newViewPort = new QWidget(scrollArea);
auto layout = new QVBoxLayout(newViewPort);
QSize minimumSize = newViewPort->sizeHint();
int x = 0;
foreach(const auto &share, shares) {
// We don't handle link shares
if (share->getShareType() == Share::TypeLink) {
continue;
}
ShareWidget *s = new ShareWidget(share, _ui->scrollArea);
layout->addWidget(s);
x++;
if (x <= 3) {
minimumSize = newViewPort->sizeHint();
}
}
minimumSize.rwidth() += layout->spacing();
minimumSize.rheight() += layout->spacing();
scrollArea->setMinimumSize(minimumSize);
scrollArea->setVisible(!shares.isEmpty());
scrollArea->setWidget(newViewPort);
}
示例3: slotAdjustScrollWidgetSize
void ShareUserGroupWidget::slotAdjustScrollWidgetSize()
{
QScrollArea *scrollArea = _ui->scrollArea;
if (scrollArea->findChildren<ShareWidget*>().count() <= 3) {
auto minimumSize = scrollArea->widget()->sizeHint();
auto spacing = scrollArea->widget()->layout()->spacing();
minimumSize.rwidth() += spacing;
minimumSize.rheight() += spacing;
scrollArea->setMinimumSize(minimumSize);
}
}
示例4: QMainWindow
PixEditor::PixEditor(QWidget *parent)
: QMainWindow(parent)
{
barreEtat=statusBar();
addMenu();
addock();
addtoolbar();
QScrollArea *defilement = new QScrollArea();
defilement->setMinimumSize(QSize(500,500));
setCentralWidget(defilement);
defilement->setWidget(&widgetcentral);
defilement->setWidgetResizable(true);
}
示例5: setWindowTitle
Values::Values(Information *info)
{
information = info;
setWindowTitle(tr("Values table"));
setWindowIcon(QIcon(":/icons/valuesTable.png"));
QHBoxLayout *mainLayout = new QHBoxLayout();
QPushButton *addButton = new QPushButton(tr("Add"));
addButton->setFixedSize(80,80);
connect(addButton, SIGNAL(released()), this, SLOT(addValuesTable()));
QScrollArea *scrollArea = new QScrollArea();
scrollArea->setWidgetResizable(true);
scrollArea->setMinimumSize(400,400);
mainLayout->addWidget(scrollArea);
mainLayout->addWidget(addButton);
setLayout(mainLayout);
widget = new QWidget();
widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
QHBoxLayout *widgetLayout = new QHBoxLayout;
widgetLayout->setMargin(0);
tablesLayout = new QHBoxLayout();
tablesLayout->setSpacing(25);
widgetLayout->addLayout(tablesLayout);
widgetLayout->addStretch();
widget->setLayout(widgetLayout);
scrollArea->setWidget(widget);
addValuesTable();
}
示例6: slotSharesFetched
void ShareUserGroupWidget::slotSharesFetched(const QList<QSharedPointer<Share>> &shares)
{
QScrollArea *scrollArea = _ui->scrollArea;
auto newViewPort = new QWidget(scrollArea);
auto layout = new QVBoxLayout(newViewPort);
QSize minimumSize = newViewPort->sizeHint();
int x = 0;
foreach(const auto &share, shares) {
// We don't handle link shares
if (share->getShareType() == Share::TypeLink) {
continue;
}
ShareWidget *s = new ShareWidget(share, _isFile, _ui->scrollArea);
connect(s, SIGNAL(resizeRequested()), this, SLOT(slotAdjustScrollWidgetSize()));
layout->addWidget(s);
x++;
if (x <= 3) {
minimumSize = newViewPort->sizeHint();
} else {
minimumSize.rwidth() = qMax(newViewPort->sizeHint().width(), minimumSize.width());
}
}
minimumSize.rwidth() += layout->spacing();
minimumSize.rheight() += layout->spacing();
scrollArea->setMinimumSize(minimumSize);
scrollArea->setVisible(!shares.isEmpty());
scrollArea->setWidget(newViewPort);
_disableCompleterActivated = false;
_ui->shareeLineEdit->setEnabled(true);
}
示例7: QMainWindow
//.........这里部分代码省略.........
connect(this, SIGNAL(UpdateList()), mBodySetWidget, SLOT(UpdateList()));
connect(this, SIGNAL(UpdateList()), mCameraSetWidget, SLOT(UpdateList()));
connect(this, SIGNAL(UpdateList()), mGUISetWidget, SLOT(UpdateList()));
connect(this, SIGNAL(UpdateList()), mGUITextSetWidget, SLOT(UpdateList()));
connect(this, SIGNAL(UpdateList()), mImageSetWidget, SLOT(UpdateList()));
connect(this, SIGNAL(UpdateList()), mParticleSetWidget, SLOT(UpdateList()));
connect(this, SIGNAL(UpdateList()), mSubWindowSetWidget, SLOT(UpdateList()));
connect(this, SIGNAL(UpdateList()), mAnimationSetWidget, SLOT(UpdateList()));
connect(this, SIGNAL(UpdateList()), mLightSetWidget, SLOT(UpdateList()));
connect(this, SIGNAL(UpdateList()), mNodeSetWidget, SLOT(UpdateList()));
connect(this, SIGNAL(UpdateList()), mSimulationSetWidget, SLOT(UpdateList()));
connect(this, SIGNAL(UpdateList()), mSimBodySetWidget, SLOT(UpdateList()));
connect(this, SIGNAL(UpdateList()), mSimJointSetWidget, SLOT(UpdateList()));
connect(this, SIGNAL(UpdateList()), mOtherSetWidget, SLOT(UpdateList()));
connect(mBodySetWidget, SIGNAL(UpdateBody()), mNodeSetWidget, SLOT(UpdateList()));
connect(mParticleSetWidget, SIGNAL(UpdateParticle()), mNodeSetWidget, SLOT(UpdateList()));
connect(mAnimationSetWidget, SIGNAL(UpdateAnimation()), mNodeSetWidget, SLOT(UpdateList()));
connect(mLightSetWidget, SIGNAL(UpdateLight()), mNodeSetWidget, SLOT(UpdateList()));
connect(mSimBodySetWidget, SIGNAL(UpdateODEBody()), mNodeSetWidget, SLOT(UpdateList()));
connect(mSimJointSetWidget, SIGNAL(UpdateODEJoint()), mNodeSetWidget, SLOT(UpdateList()));
connect(mSimBodySetWidget, SIGNAL(UpdateODEBody()), mSimJointSetWidget, SLOT(UpdateList()));
connect(mOgreWidget, SIGNAL(mouseMoveSignal(QMouseEvent*, int, int)), mCameraSetWidget, SLOT(mouseMoveSlot(QMouseEvent*, int, int)));
connect(mOgreWidget, SIGNAL(mousePressSignal(QMouseEvent*)), mCameraSetWidget, SLOT(mousePressSlot(QMouseEvent*)));
connect(mOgreWidget, SIGNAL(mouseReleaseSignal(QMouseEvent*)), mCameraSetWidget, SLOT(mouseReleaseSlot(QMouseEvent*)));
connect(mOgreWidget, SIGNAL(mouseMoveSignal(QMouseEvent*, int, int)), mBodySetWidget, SLOT(mouseMoveSlot(QMouseEvent*, int, int)));
connect(mOgreWidget, SIGNAL(mousePressSignal(QMouseEvent*)), mBodySetWidget, SLOT(mousePressSlot(QMouseEvent*)));
connect(mOgreWidget, SIGNAL(mouseReleaseSignal(QMouseEvent*)), mBodySetWidget, SLOT(mouseReleaseSlot(QMouseEvent*)));
QVBoxLayout *alayout = new QVBoxLayout;
alayout->addWidget(tabWidget);
QWidget *awidget = new QWidget;
awidget->setLayout(alayout);
tabWidget->setMinimumSize(250, 768);
tabWidget->setMaximumWidth(250);
QScrollArea *area = new QScrollArea();
area->setWidget(awidget);
area->setMaximumSize(300, 708);
area->setMinimumSize(300, 708);
layout->addWidget(area);
QWidget *widget = new QWidget;
widget->setLayout(layout);
widget->setMinimumSize(1244, 708);
setCentralWidget(widget);
setWindowTitle(tr("OgreRTC"));
setUnifiedTitleAndToolBarOnMac(true);
mOgreWidget->initOgre();
EC = mOgreWidget->mOgreRTCApplication;
mBodySetWidget->EC = mOgreWidget->mOgreRTCApplication;
mBornSetWidget->EC = mOgreWidget->mOgreRTCApplication;
mCameraSetWidget->EC = mOgreWidget->mOgreRTCApplication;
mGUISetWidget->EC = mOgreWidget->mOgreRTCApplication;
mGUITextSetWidget->EC = mOgreWidget->mOgreRTCApplication;
mImageSetWidget->EC = mOgreWidget->mOgreRTCApplication;
mParticleSetWidget->EC = mOgreWidget->mOgreRTCApplication;
mSubWindowSetWidget->EC = mOgreWidget->mOgreRTCApplication;
mAnimationSetWidget->EC = mOgreWidget->mOgreRTCApplication;
mLightSetWidget->EC = mOgreWidget->mOgreRTCApplication;
mNodeSetWidget->EC = mOgreWidget->mOgreRTCApplication;
mSimulationSetWidget->EC = mOgreWidget->mOgreRTCApplication;
mSimBodySetWidget->EC = mOgreWidget->mOgreRTCApplication;
mSimJointSetWidget->EC = mOgreWidget->mOgreRTCApplication;
mOtherSetWidget->EC = mOgreWidget->mOgreRTCApplication;
createAction();
createMenus();
if(EC && argc > 1)
{
EC->reset();
EC->OpenFile(argv[1]);
}
}
示例8: displayMap
void MainWindow::displayMap(const QString key)
{
{
const QString &file=key;
if(!not_finishedFile.contains(key) && !finishedFile.contains(key))
abort();
MapContent mapContent;
if(not_finishedFile.contains(key))
mapContent=not_finishedFile.value(key);
else if(finishedFile.contains(key))
mapContent=finishedFile.value(key);
else
abort();
if(mapContent.region.isEmpty())
abort();
ui->region->setText(mapContent.region);
ui->zone->setText(mapContent.zone);
ui->subzone->setText(mapContent.subzone);
ui->name->setText(mapContent.name);
ui->type->setCurrentIndex(ui->type->findText(mapContent.type));
ui->officialZone->setChecked(mapContent.officialzone);
ui->finished->setChecked(finishedFile.contains(key));
QString pngDest=TMPDATA+file;
pngDest.replace(".tmx",".png");
ui->currentMapPreview->setPixmap(QPixmap(pngDest));
{
QLayoutItem *item = NULL;
while ((item = ui->horizontalLayout_3->takeAt(0)) != 0) {
delete item->widget();
}
//ui->horizontalLayout_3->widget()->deleteLater();
//delete ui->scrollArea;
QString fileSort=file;
fileSort.replace(".tmx","");
const std::string &fileSortStd=fileSort.toStdString();
if(map_list.find(fileSortStd)!=map_list.cend())
{
const CatchChallenger::MapServer * const mapPointer=map_list.at(fileSortStd);
QScrollArea *scrollArea = new QScrollArea(ui->groupBox);
scrollArea->setMinimumSize(QSize(350, 0));
scrollArea->setWidgetResizable(true);
QWidget * scrollAreaWidgetContents = new QWidget();
scrollAreaWidgetContents->setGeometry(QRect(0, 0, 892, 337));
QHBoxLayout * horizontalLayout_2 = new QHBoxLayout(scrollAreaWidgetContents);
horizontalLayout_2->setSpacing(6);
horizontalLayout_2->setContentsMargins(11, 11, 11, 11);
unsigned int mapIndex=0;
while(mapIndex<mapPointer->linked_map.size())
{
const CatchChallenger::CommonMap * const map=mapPointer->linked_map.at(mapIndex);
bool haveContent=true;
MapContent mapContent;
if(not_finishedFile.contains(QString::fromStdString(map->map_file)+".tmx"))
mapContent=not_finishedFile.value(QString::fromStdString(map->map_file)+".tmx");
else if(finishedFile.contains(QString::fromStdString(map->map_file)+".tmx"))
mapContent=finishedFile.value(QString::fromStdString(map->map_file)+".tmx");
else
abort();//haveContent=false;
if(haveContent)
{
QGroupBox * groupBox_4 = new QGroupBox(scrollAreaWidgetContents);
if(finishedFile.contains(QString::fromStdString(map->map_file)+".tmx"))
{
if(mapContent.type=="outdoor")
groupBox_4->setStyleSheet("background-color: rgb(60, 230, 108);");
else if(mapContent.type=="city")
groupBox_4->setStyleSheet("background-color: #e7ff43;");
else if(mapContent.type=="indoor")
groupBox_4->setStyleSheet("background-color: #ff4343;");
else if(mapContent.type=="cave")
groupBox_4->setStyleSheet("background-color: #9b6c14;");
else
groupBox_4->setStyleSheet("background-color: #43d2ff;");
}
groupBox_4->setMaximumSize(QSize(300, 300));
QVBoxLayout * verticalLayout = new QVBoxLayout(groupBox_4);
verticalLayout->setSpacing(6);
verticalLayout->setContentsMargins(11, 11, 11, 11);
QLabel * label_6 = new QLabel(groupBox_4);
label_6->setPixmap(QPixmap(TMPDATA+QString::fromStdString(map->map_file)+".png"));
label_6->setScaledContents(true);
verticalLayout->addWidget(label_6);
QLabel * label_7 = new QLabel(groupBox_4);
verticalLayout->addWidget(label_7);
QLabel * label_8 = new QLabel(groupBox_4);
verticalLayout->addWidget(label_8);
QLabel * label_9 = new QLabel(groupBox_4);
verticalLayout->addWidget(label_9);
QLabel * label_10 = new QLabel(groupBox_4);
verticalLayout->addWidget(label_10);
horizontalLayout_2->addWidget(groupBox_4);
scrollArea->setWidget(scrollAreaWidgetContents);
//.........这里部分代码省略.........
示例9: ext
//.........这里部分代码省略.........
// output directory
_outputDir = new QLineEdit();
QSettings settings;
QString dir = settings.value("openFile/dir", "").toString();
_outputDir->setText(dir);
QPushButton* outputDirButton = new QPushButton("...");
connect(outputDirButton, SIGNAL(clicked()), SLOT(outputDirSlot()));
QGridLayout* dirLayout = new QGridLayout();
dirLayout->addWidget(new QLabel("Dir:"), 0, 0);
dirLayout->addWidget(_outputDir, 0, 2);
dirLayout->addWidget(outputDirButton, 0, 4);
dirLayout->setColumnStretch(2, 1);
verticalLayout->addLayout(dirLayout);
// type
_typeBox = new QComboBox();
_typeBox->addItem("obj");
_typeBox->addItem("off");
_typeBox->addItem("raw");
QHBoxLayout* typeLayout = new QHBoxLayout();
typeLayout->addWidget(new QLabel("Type:"), 0, Qt::AlignRight);
typeLayout->addWidget(_typeBox, 0, Qt::AlignRight);
verticalLayout->addLayout(typeLayout);
// ok and cancel
buttonBox = new QDialogButtonBox(this);
buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
buttonBox->setOrientation(Qt::Horizontal);
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
verticalLayout->addWidget(buttonBox);
setWindowTitle("Save Geometry");
QObject::connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
QObject::connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
QMetaObject::connectSlotsByName(this);
std::vector<std::string> keys = cvcapp.data<cvcraw_geometry::cvcgeom_t>();
if(keys.empty()) {
QMessageBox::information(this, tr("Laplace Skeletonization"),
tr("No geometry loaded."), QMessageBox::Ok);
}
else {
gridLayout->addWidget(new QLabel("Geometry"), 0, 0);
// gridLayout->setColumnMinimumWidth(1, 5);
gridLayout->addWidget(new QLabel("Output filename"), 0, 2);
gridLayout->setColumnStretch(2, 1);
vector<string> vprops = cvcapp.listProperty("zoomed.geometries");
set<string> props(vprops.begin(), vprops.end());
BOOST_FOREACH(std::string key, keys) {
const cvcraw_geometry::cvcgeom_t geom =
boost::any_cast<cvcraw_geometry::cvcgeom_t>(cvcapp.data()[key]);
if (geom.points().size() > 0 &&
geom.const_tets().empty() &&
props.find(key) != props.end()) {
std::string segmentedString = "-segmented";
int sizeSegmented = segmentedString.length();
int positionSegmented = key.rfind(segmentedString);
if(positionSegmented != NOT_FOUND)
key.replace(key.rfind(segmentedString),sizeSegmented,"");
string ext(".raw");
switch (GetType(geom)) {
case kRaw:
ext = ".raw";
break;
case kRawn:
ext = ".rawn";
break;
case kRawc:
ext = ".rawc";
break;
case kRawnc:
ext = ".rawnc";
break;
}
const int i = _boxes.size();
_boxes.push_back(new QCheckBox(QString::fromStdString(key)));//, this));
// _filenames.push_back(new QLineEdit(QString::fromStdString(key+ext)));//, this));
_filenames.push_back(new QLineEdit(QString::fromStdString(key)));//, this));
_boxes[i]->setCheckState(Qt::Checked);
gridLayout->addWidget(_boxes[i], i+1, 0);
gridLayout->addWidget(_filenames[i], i+1, 2);
}
}
QSize size = gridLayout->minimumSize();
scrollArea->setMinimumSize(QSize(min(size.width()+10, 400), min(size.height()+10, 300)));
}
resize(minimumSizeHint());
}