本文整理汇总了C++中QListView::setSizePolicy方法的典型用法代码示例。如果您正苦于以下问题:C++ QListView::setSizePolicy方法的具体用法?C++ QListView::setSizePolicy怎么用?C++ QListView::setSizePolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListView
的用法示例。
在下文中一共展示了QListView::setSizePolicy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ctkExpandableWidgetTest1
//-----------------------------------------------------------------------------
int ctkExpandableWidgetTest1(int argc, char * argv [] )
{
QApplication::setStyle(new QPlastiqueStyle);
QApplication app(argc, argv);
QWidget topLevel;
QHBoxLayout* topLevelLayout = new QHBoxLayout;
topLevel.setLayout(topLevelLayout);
QWidget frame;
topLevelLayout->addWidget(&frame);
ctkExpandableWidget resizableFrame1(&frame);
QListView* listView = new QListView(&resizableFrame1);
listView->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
QVBoxLayout* resizableFrameLayout1 = new QVBoxLayout(&resizableFrame1);
resizableFrameLayout1->setContentsMargins(0,0,0,0);
resizableFrame1.setSizeGripMargins(QSize(2, 2));
resizableFrame1.setLayout(resizableFrameLayout1);
resizableFrameLayout1->addWidget(listView);
resizableFrame1.setOrientations(Qt::Horizontal | Qt::Vertical);
ctkExpandableWidget resizableFrame(&frame);
resizableFrame.setSizeGripInside(false);
QTreeView* treeView = new QTreeView(&resizableFrame);
treeView->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
QVBoxLayout* resizableFrameLayout = new QVBoxLayout(&resizableFrame);
resizableFrameLayout->setContentsMargins(0,0,0,0);
//resizableFrame.setSizeGripMargins(QSize(2, 2));
resizableFrame.setLayout(resizableFrameLayout);
resizableFrameLayout->addWidget(treeView);
resizableFrame.setOrientations(Qt::Horizontal);
QVBoxLayout *vbox = new QVBoxLayout;
vbox->setContentsMargins(0, 0, 0, 0);
vbox->addWidget(&resizableFrame1);
vbox->addWidget(&resizableFrame);
frame.setLayout(vbox);
ctkExpandableWidget resizableFrame0(&topLevel);
QTableView* tableView = new QTableView(&resizableFrame0);
tableView->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred));
QVBoxLayout* resizableFrameLayout0 = new QVBoxLayout(&resizableFrame0);
resizableFrameLayout0->setContentsMargins(0,0,0,0);
resizableFrame0.setSizeGripMargins(QSize(2, 2));
resizableFrame0.setLayout(resizableFrameLayout0);
resizableFrameLayout0->addWidget(tableView);
resizableFrame0.setOrientations(Qt::Vertical);
topLevelLayout->addWidget(&resizableFrame0);
topLevel.show();
if (argc < 2 || QString(argv[1]) != "-I" )
{
QTimer::singleShot(200, &app, SLOT(quit()));
}
return app.exec();
}
示例2: hack
void ComboBox::hack()
{
QListView *v = new QListView( this );
v->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
v->setMinimumHeight( 50 );
v->setModel( model() );
setView( v );
}
示例3: QWidget
SongEditorWindow::SongEditorWindow(SlideGroup *g, QWidget *parent) :
AbstractSlideGroupEditor(g,parent),
m_slideGroup(0),
m_editWin(0),
m_syncToDatabase(true),
m_arrModel(0)
{
setAttribute(Qt::WA_DeleteOnClose,true);
QWidget *centerWidget = new QWidget(this);
QVBoxLayout * vbox = new QVBoxLayout(centerWidget);
// Title editor
QHBoxLayout * hbox1 = new QHBoxLayout();
QLabel *label = new QLabel("&Title: ");
hbox1->addWidget(label);
m_title = new QLineEdit();
label->setBuddy(m_title);
hbox1->addWidget(m_title);
vbox->addLayout(hbox1);
// Default arrangement
QHBoxLayout *hbox2 = new QHBoxLayout();
label = new QLabel("Default Arrangement: ");
hbox2->addWidget(label);
m_defaultArrangement = new QLineEdit();
m_defaultArrangement->setReadOnly(true);
QPalette p = m_defaultArrangement->palette();
p.setColor(QPalette::Base, Qt::lightGray);
m_defaultArrangement->setPalette(p);
hbox2->addWidget(m_defaultArrangement);
vbox->addLayout(hbox2);
// My arrangement
QHBoxLayout *hbox3 = new QHBoxLayout();
label = new QLabel("&Arrangement:");
hbox3->addWidget(label);
//m_arrangement = new QLineEdit();
//m_arrangement->setReadOnly(false);
m_arrangement = new QComboBox();
m_arrangement->setEditable(true);
m_arrangement->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
connect(m_arrangement, SIGNAL(editTextChanged(const QString&)), this, SLOT(arrTextChanged(const QString&)));
connect(m_arrangement, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(arrCurrentIndexChanged(const QString&)));
connect(m_arrangement, SIGNAL(activated(const QString &)), this, SLOT(arrActivated(const QString&)));
label->setBuddy(m_arrangement);
hbox3->addWidget(m_arrangement);
QPushButton *btn = new QPushButton("Default");
btn->setIcon(QIcon(":/data/stock-undo.png"));
btn->setToolTip("Reset arrangement to default arrangement (above)");
connect(btn, SIGNAL(clicked()), this, SLOT(resetArr()));
hbox3->addWidget(btn);
btn = new QPushButton("Show/Hide List");
btn->setCheckable(true);
btn->setIcon(QIcon(":/data/stock-find-and-replace.png"));
btn->setToolTip("Show/hide the arrangement drag-and-drop list");
connect(btn, SIGNAL(toggled(bool)), this, SLOT(arrListViewToggled(bool)));
hbox3->addWidget(btn);
QPushButton *listBtn = btn;
vbox->addLayout(hbox3);
setWindowIcon(QIcon(":/data/icon-d.png"));
QFont font;
font.setFamily("Courier");
font.setFixedPitch(true);
font.setPointSize(10);
//QHBoxLayout *editorHBox = new QHBoxLayout();
//editorHBox->setContentsMargins(0,0,0,0);
QSplitter *editorHBox = new QSplitter();
m_editor = new MyQTextEdit;
m_editor->setFont(font);
editorHBox->addWidget(m_editor);
connect(m_editor, SIGNAL(textChanged()), this, SLOT(editTextChanged()));
//m_editor->setAcceptRichText(false);
m_highlighter = new SongEditorHighlighter(m_editor->document());
// Arrangement preview box
m_arrangementPreview = new MyQTextEdit;
m_arrangementPreview->setFont(font);
m_arrangementPreview->setReadOnly(true);
//.........这里部分代码省略.........