本文整理汇总了C++中QScrollArea::setWidgetResizable方法的典型用法代码示例。如果您正苦于以下问题:C++ QScrollArea::setWidgetResizable方法的具体用法?C++ QScrollArea::setWidgetResizable怎么用?C++ QScrollArea::setWidgetResizable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScrollArea
的用法示例。
在下文中一共展示了QScrollArea::setWidgetResizable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupUi
void ThumbnailListWidgetTest::setupUi() {
QGridLayout *layout = new QGridLayout(this);
QScrollArea *horizontalScrollArea = new QScrollArea(this);
horizontalScrollArea->setWidget(horizontal);
horizontalScrollArea->setWidgetResizable(true);
QScrollArea *verticalScrollArea = new QScrollArea(this);
verticalScrollArea->setWidget(vertical);
verticalScrollArea->setWidgetResizable(true);
layout->addWidget(horizontalScrollArea, 0, 1, 1, 3);
layout->addWidget(verticalScrollArea, 1, 0, 3, 1);
lblhorizontalActivated = new QLabel("Horizontal activated");
lblverticalActivated = new QLabel("Vertical activated");
layout->addWidget(lblhorizontalActivated, 1, 1);
layout->addWidget(lblverticalActivated, 1, 2);
lblhorizontalDeactivated = new QLabel("Horizontal deactivated");
lblverticalDeactivated = new QLabel("Vertical deactivated");
layout->addWidget(lblhorizontalDeactivated, 2, 1);
layout->addWidget(lblverticalDeactivated, 2, 2);
lblhorizontalVideoAdded = new QLabel("Horizontal video added");
lblverticalVideoAdded = new QLabel("Vertical video added");
layout->addWidget(lblhorizontalVideoAdded, 3, 1);
layout->addWidget(lblverticalVideoAdded, 3, 2);
setLayout(layout);
}
示例2: activated
void FileBrowser::activated(const QModelIndex &index)
{
QFileInfo fileInfo = fileSystemModel->fileInfo(index);
if (fileInfo.isDir() && fileInfo.fileName() != QLatin1String(".")) {
if (fileInfo.fileName() == QLatin1String("..")) {
QModelIndex parent = view->rootIndex().parent();
fileInfo = fileSystemModel->fileInfo(parent);
if (fileInfo.absoluteFilePath() == rootPath)
fileSystemModel->setFilter(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs);
view->setRootIndex(parent);
} else {
fileSystemModel->setFilter(QDir::AllEntries | QDir::AllDirs);
view->setRootIndex(index);
}
setWindowTitle(fileInfo.fileName());
} else {
if (fileInfo.fileName() == QLatin1String("."))
fileInfo = fileSystemModel->fileInfo(view->rootIndex());
#if defined(Q_WS_MAEMO_5)
DocumentPropertiesWidget *widget = new DocumentPropertiesWidget(fileInfo, gallery, this);
widget->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred);
QScrollArea *window = new QScrollArea(this);
window->setWindowFlags(window->windowFlags() | Qt::Window);
window->setAttribute(Qt::WA_DeleteOnClose);
window->setAttribute(Qt::WA_Maemo5StackedWindow);
window->setWidgetResizable(true);
window->setWidget(widget);
window->show();
#elif defined (Q_OS_SYMBIAN)
QScrollArea *window = new QScrollArea(this);
DocumentPropertiesWidget *widget = new DocumentPropertiesWidget(fileInfo, gallery, window);
widget->setWindowModality(Qt::WindowModal);
window->setWindowFlags(window->windowFlags() | Qt::Dialog);
window->setAttribute(Qt::WA_DeleteOnClose);
window->setWidgetResizable(true);
window->setWidget(widget);
window->showMaximized();
#else
DocumentPropertiesWidget *widget = new DocumentPropertiesWidget(fileInfo, gallery, this);
widget->setWindowFlags(widget->windowFlags() | Qt::Dialog);
widget->setAttribute(Qt::WA_DeleteOnClose);
widget->setWindowModality(Qt::WindowModal);
# if defined(Q_OS_SYMBIAN)
widget->showMaximized();
# else
widget->show();
# endif
#endif
}
}
示例3: reloadData
void StackedWidget::reloadData() {
removePages();
DataManager& manager = DataManager::getInstance();
if( manager.isempty() ) {
addWidget( new QLabel(tr("No quantities found.")) );
return;
}
//Home
StackedWidgetHome *home = new StackedWidgetHome(this);
addWidget(home);
connect(home, &StackedWidgetHome::quantityChosen, this, &StackedWidget::quantityChosen);
//all quantities
for(Quantity& quantity : manager) {
QScrollArea *scroll = new QScrollArea(this);
scroll->setWidgetResizable(true);
scroll->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
scroll->setWidget(new QuantityWidget( quantity, this ));
addWidget(scroll);
}
QStackedWidget::update();
}
示例4: QWizardPage
DocumentTypeSelectionPage::DocumentTypeSelectionPage(QWidget* parent) : QWizardPage(parent)
{
QVBoxLayout *vb = new QVBoxLayout;
QScrollArea *scroll = new QScrollArea;
scroll->setWidgetResizable(true);
scroll->setFocusPolicy(Qt::NoFocus);
scroll->setFrameShape(QFrame::NoFrame);
scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_ui = new Ui::DocumentTypeSelector;
m_ui->setupUi(scroll);
vb->addWidget(scroll);
setLayout(vb);
registerField("documentsTypeSelectionPage_minimumSize", m_ui->minimumSize);
registerField("documentsTypeSelectionPage_allLocations", m_ui->allLocations, "checked");
registerField("documentsTypeSelectionPage_location", m_ui->location, "installationPath");
registerField("documentsTypeSelectionPage_allDocuments", m_ui->allDocuments);
registerField("documentsTypeSelectionPage_audioDocuments", m_ui->audioDocuments);
registerField("documentsTypeSelectionPage_imageDocuments", m_ui->imageDocuments);
registerField("documentsTypeSelectionPage_textDocuments", m_ui->textDocuments);
registerField("documentsTypeSelectionPage_videoDocuments", m_ui->videoDocuments);
connect(m_ui->allDocuments, SIGNAL(clicked(bool)), this, SLOT(alltypes(bool)));
connect(m_ui->allDocuments, SIGNAL(clicked()), this, SIGNAL(completeChanged()));
connect(m_ui->audioDocuments, SIGNAL(clicked()), this, SIGNAL(completeChanged()));
connect(m_ui->imageDocuments, SIGNAL(clicked()), this, SIGNAL(completeChanged()));
connect(m_ui->textDocuments, SIGNAL(clicked()), this, SIGNAL(completeChanged()));
connect(m_ui->videoDocuments, SIGNAL(clicked()), this, SIGNAL(completeChanged()));
}
示例5: QFrame
EventVideoDownloadsWindow::EventVideoDownloadsWindow(QWidget *parent) :
QFrame(parent)
{
setAttribute(Qt::WA_DeleteOnClose, true);
setMinimumSize(550, 300);
setWindowTitle(tr("Bluecherry - Download Manager"));
QVBoxLayout *layout = new QVBoxLayout(this);
layout->setSpacing(2);
layout->setMargin(2);
QScrollArea *downloadArea = new QScrollArea(this);
downloadArea->setBackgroundRole(QPalette::Base );
downloadArea->move(0, 0);
layout->addWidget(downloadArea);
QFrame *downloadFrame = new QFrame;
downloadFrame->setBackgroundRole(QPalette::Base);
downloadFrame->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
m_downloadLayout = new QVBoxLayout(downloadFrame);
m_downloadLayout->setDirection(QBoxLayout::Up);
downloadArea->setWidget(downloadFrame);
downloadArea->setWidgetResizable(true);
QSettings settings;
restoreGeometry(settings.value(QLatin1String("ui/downloadsWindow/geometry")).toByteArray());
connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(saveSettings()));
}
示例6: QHBoxLayout
QTORGANIZER_USE_NAMESPACE
AddCalendarPage::AddCalendarPage(QWidget *parent)
:QWidget(parent),
m_manager(0)
{
QHBoxLayout* hbLayout = new QHBoxLayout();
QPushButton *okButton = new QPushButton("Save", this);
connect(okButton,SIGNAL(clicked()),this,SLOT(saveClicked()));
hbLayout->addWidget(okButton);
QPushButton *cancelButton = new QPushButton("Cancel", this);
connect(cancelButton,SIGNAL(clicked()),this,SLOT(cancelClicked()));
hbLayout->addWidget(cancelButton);
QVBoxLayout *scrollAreaLayout = new QVBoxLayout();
scrollAreaLayout->addStretch();
scrollAreaLayout->addLayout(hbLayout);
QScrollArea *scrollArea = new QScrollArea(this);
scrollArea->setWidgetResizable(true);
QWidget *formContainer = new QWidget(scrollArea);
formContainer->setLayout(scrollAreaLayout);
scrollArea->setWidget(formContainer);
QVBoxLayout *mainLayout = new QVBoxLayout();
mainLayout->addWidget(scrollArea);
setLayout(mainLayout);
}
示例7: OracleWizardPage
ChooseSetsPage::ChooseSetsPage(QWidget *parent)
: OracleWizardPage(parent)
{
setTitle(tr("Sets selection"));
setSubTitle(tr("The following sets has been found in the source file. "
"Please mark the sets that will be imported."));
checkBoxLayout = new QVBoxLayout;
QWidget *checkboxFrame = new QWidget(this);
checkboxFrame->setLayout(checkBoxLayout);
QScrollArea *checkboxArea = new QScrollArea(this);
checkboxArea->setWidget(checkboxFrame);
checkboxArea->setWidgetResizable(true);
checkAllButton = new QPushButton(tr("&Check all"));
connect(checkAllButton, SIGNAL(clicked()), this, SLOT(actCheckAll()));
uncheckAllButton = new QPushButton(tr("&Uncheck all"));
connect(uncheckAllButton, SIGNAL(clicked()), this, SLOT(actUncheckAll()));
QGridLayout *layout = new QGridLayout(this);
layout->addWidget(checkboxArea, 0, 0, 1, 2);
layout->addWidget(checkAllButton, 1, 0);
layout->addWidget(uncheckAllButton, 1, 1);
setLayout(layout);
}
示例8: addPageWidget
void DlgPreferences::addPageWidget(DlgPreferencePage* pWidget) {
connect(this, SIGNAL(showDlg()),
pWidget, SLOT(slotShow()));
connect(this, SIGNAL(closeDlg()),
pWidget, SLOT(slotHide()));
connect(this, SIGNAL(showDlg()),
pWidget, SLOT(slotUpdate()));
connect(this, SIGNAL(applyPreferences()),
pWidget, SLOT(slotApply()));
connect(this, SIGNAL(cancelPreferences()),
pWidget, SLOT(slotCancel()));
connect(this, SIGNAL(resetToDefaults()),
pWidget, SLOT(slotResetToDefaults()));
QScrollArea* sa = new QScrollArea(pagesWidget);
sa->setWidgetResizable(true);
sa->setWidget(pWidget);
pagesWidget->addWidget(sa);
int iframe = 2 * sa->frameWidth();
m_pageSizeHint = m_pageSizeHint.expandedTo(
pWidget->sizeHint()+QSize(iframe, iframe));
}
示例9: updateManager
void ChordsManager::updateManager()
{
if(chords_==0){
return;
}
tabWidget->clear();
QList<Instrument> instruments = chords_->getInstruments();
foreach(Instrument instrument, instruments){
QScrollArea *area = new QScrollArea();
QList<Chord> list = chords_->getChords(instrument);
QGridLayout *gridLayout = new QGridLayout;
area->setWidgetResizable(true);
QWidget *w = new QWidget;
w->setLayout(gridLayout);
area->setWidget(w);
int nb = this->width() / 200;
for(int i=0;i<list.size();i++){
Guitar *guitar = new Guitar(list[i].getName(), list[i].getFingers());
guitar->setMenu(!list[i].isLocked(),false,false);
gridLayout->addWidget( guitar , i/nb, i%nb);
}
int index = tabWidget->addTab(area, instrument.name );
if(instrument.label=="guitar"){
tabWidget->setCurrentIndex(index);
}
}
示例10: QWidget
cqts_SkillsEditor::cqts_SkillsEditor(CQTs_Character *selected, CQTs_engine *engine, QWidget *parent):
QWidget(parent)
{
eng = engine;
QWidget* toscroll = new QWidget();
QScrollArea *Scroll = new QScrollArea;
QFormLayout *grid = new QFormLayout();
newSpinSkills = new QSpinBox* [eng->skillNum()];
for (int i = 0; i < eng->skillNum(); ++i) {
newSpinSkills[i] = new QSpinBox();
newSpinSkills[i]->setValue(selected->getRanks(eng->skillData(i)));
grid->addRow(eng->skillData(i).myName(),newSpinSkills[i]);
}
toscroll->setLayout(grid);
Scroll->setWidget(toscroll);
Scroll->setWidgetResizable(true);
Scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
Scroll->setMinimumWidth(200);
QVBoxLayout *VLay= new QVBoxLayout();
VLay->addWidget(Scroll);
saveBTT = new QPushButton("&Save");
undoBTT = new QPushButton("&Undo");
QHBoxLayout *tLay= new QHBoxLayout();
tLay->addWidget(undoBTT);
tLay->addWidget(saveBTT);
VLay->addLayout(tLay);
setLayout(VLay);
connect(undoBTT,SIGNAL(clicked()),this,SLOT(close()));
connect(saveBTT,SIGNAL(clicked()),this,SLOT(update()));
}
示例11: resizeEvent
void DlgPreferencesImp::resizeEvent(QResizeEvent* ev)
{
if (canEmbedScrollArea) {
// embed the widget stack into a scroll area if the size is
// bigger than the available desktop
QRect rect = QApplication::desktop()->availableGeometry();
int maxHeight = rect.height();
int maxWidth = rect.width();
if (height() > maxHeight || width() > maxWidth) {
canEmbedScrollArea = false;
ui->hboxLayout->removeWidget(ui->tabWidgetStack);
QScrollArea* scrollArea = new QScrollArea(this);
scrollArea->setFrameShape(QFrame::NoFrame);
scrollArea->setWidgetResizable(true);
scrollArea->setWidget(ui->tabWidgetStack);
ui->hboxLayout->addWidget(scrollArea);
// if possible the minimum width should so that it doesn't show
// a horizontal scroll bar.
QScrollBar* bar = scrollArea->verticalScrollBar();
if (bar) {
int newWidth = width() + bar->width();
newWidth = std::min<int>(newWidth, maxWidth);
int newHeight = std::min<int>(height(), maxHeight-30);
QMetaObject::invokeMethod(this, "resizeWindow",
Qt::QueuedConnection,
QGenericReturnArgument(),
Q_ARG(int, newWidth),
Q_ARG(int, newHeight));
}
}
}
示例12: setupUi
void TwitterApiShowThread::setupUi()
{
kDebug();
QVBoxLayout *gridLayout;
QScrollArea *scrollArea;
QWidget *scrollAreaWidgetContents;
QVBoxLayout *verticalLayout_2;
QSpacerItem *verticalSpacer;
gridLayout = new QVBoxLayout(this);
gridLayout->setMargin(0);
gridLayout->setObjectName("gridLayout");
scrollArea = new QScrollArea(this);
scrollArea->setObjectName("scrollArea");
scrollArea->setFrameShape(QFrame::NoFrame);
scrollArea->setWidgetResizable(true);
scrollAreaWidgetContents = new QWidget();
scrollAreaWidgetContents->setObjectName("scrollAreaWidgetContents");
scrollAreaWidgetContents->setGeometry(QRect(0, 0, 254, 300));
verticalLayout_2 = new QVBoxLayout(scrollAreaWidgetContents);
verticalLayout_2->setMargin(1);
d->mainLayout = new QVBoxLayout();
verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
d->mainLayout->addItem(verticalSpacer);
d->mainLayout->setSpacing(3);
d->mainLayout->setMargin(1);
verticalLayout_2->addLayout(d->mainLayout);
scrollArea->setWidget(scrollAreaWidgetContents);
gridLayout->addWidget(scrollArea);
}
示例13: setup
virtual int setup() {
QScrollArea *qw;
QWidget *qChild;
uint32_t flags;
GWEN_WIDGET *wParent;
QSizePolicy::Policy hpolicy=QSizePolicy::Minimum;
QSizePolicy::Policy vpolicy=QSizePolicy::Minimum;
QLayout *qLayout;
flags=GWEN_Widget_GetFlags(_widget);
wParent=GWEN_Widget_Tree_GetParent(_widget);
qw=new QScrollArea();
qChild=new QWidget();
qChild->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
qw->setWidget(qChild);
qLayout=new QVBoxLayout(qChild);
qw->setWidgetResizable(true);
/* handle flags */
if (flags & GWEN_WIDGET_FLAGS_FILLX)
hpolicy=QSizePolicy::Expanding;
if (flags & GWEN_WIDGET_FLAGS_FILLY)
vpolicy=QSizePolicy::Expanding;
qw->setSizePolicy(hpolicy, vpolicy);
GWEN_Widget_SetImplData(_widget, QT5_DIALOG_WIDGET_REAL, (void*) qw);
GWEN_Widget_SetImplData(_widget, QT5_DIALOG_WIDGET_LAYOUT, (void*) qLayout);
if (wParent)
GWEN_Widget_AddChildGuiWidget(wParent, _widget);
return 0;
}
示例14: QWidget
EffectStackEdit::EffectStackEdit(QWidget *parent) :
QWidget(parent),
m_in(0),
m_out(0),
m_frameSize(QPoint())
{
setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
QVBoxLayout *vbox1 = new QVBoxLayout(parent);
vbox1->setContentsMargins(0, 0, 0, 0);
vbox1->setSpacing(0);
QScrollArea *area = new QScrollArea;
QWidget *wid = new QWidget(parent);
area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
area->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
wid->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
area->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding));
vbox1->addWidget(area);
area->setWidget(wid);
area->setWidgetResizable(true);
m_vbox = new QVBoxLayout(wid);
m_vbox->setContentsMargins(0, 0, 0, 0);
m_vbox->setSpacing(0);
wid->show();
}
示例15: CreatePartControl
void QmitkFunctionality::CreatePartControl(void* parent)
{
// scrollArea
QScrollArea* scrollArea = new QScrollArea;
//QVBoxLayout* scrollAreaLayout = new QVBoxLayout(scrollArea);
scrollArea->setFrameShadow(QFrame::Plain);
scrollArea->setFrameShape(QFrame::NoFrame);
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
// m_Parent
m_Parent = new QWidget;
//m_Parent->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
this->CreateQtPartControl(m_Parent);
//scrollAreaLayout->addWidget(m_Parent);
//scrollArea->setLayout(scrollAreaLayout);
// set the widget now
scrollArea->setWidgetResizable(true);
scrollArea->setWidget(m_Parent);
// add the scroll area to the real parent (the view tabbar)
QWidget* parentQWidget = static_cast<QWidget*>(parent);
QVBoxLayout* parentLayout = new QVBoxLayout(parentQWidget);
parentLayout->setMargin(0);
parentLayout->setSpacing(0);
parentLayout->addWidget(scrollArea);
// finally set the layout containing the scroll area to the parent widget (= show it)
parentQWidget->setLayout(parentLayout);
this->AfterCreateQtPartControl();
}