本文整理汇总了C++中FlowLayout::addWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ FlowLayout::addWidget方法的具体用法?C++ FlowLayout::addWidget怎么用?C++ FlowLayout::addWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlowLayout
的用法示例。
在下文中一共展示了FlowLayout::addWidget方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OperationsFrame
/*public*/ EnginesTableFrame::EnginesTableFrame(QWidget* parent) :
OperationsFrame(tr("Engines Table"), parent)
{
//super(tr("Engines Table"));
// general GUI config
setObjectName("EnginesTableFrame");
log = new Logger("EnginesTableFrame");
engineManager = EngineManager::instance();
// labels
numEngines = new QLabel();
textEngines = new QLabel();
textSep1 = new QLabel(" ");
f = NULL;
setStatusBar(new QStatusBar());
statusBar()->setSizeGripEnabled(true);
// radio buttons
sortByNumber = new QRadioButton(tr("Number"));
sortByRoad = new QRadioButton(tr("Road"));
sortByModel = new QRadioButton(tr("Model"));
sortByConsist = new QRadioButton(tr("Consist"));
sortByLocation = new QRadioButton(tr("Location"));
sortByDestination = new QRadioButton(tr("Destination"));
sortByTrain = new QRadioButton(tr("Train"));
sortByMoves = new QRadioButton(tr("Moves"));
sortByBuilt = new QRadioButton(tr("Built"));
sortByOwner = new QRadioButton(tr("Owner"));
sortByValue = new QRadioButton(Setup::getValueLabel());
sortByRfid = new QRadioButton(Setup::getRfidLabel());
sortByLast = new QRadioButton(tr("Last"));
QButtonGroup* group = new QButtonGroup();
// major buttons
addButton = new QPushButton(tr("Add"));
findButton = new QPushButton(tr("Find"));
saveButton = new QPushButton(tr("Save"));
findEngineTextBox = new JTextField(6);
QVBoxLayout* thisLayout;
log->debug(tr("getContentPane returned %1").arg(getContentPane()->objectName()));
getContentPane()->setLayout(thisLayout = new QVBoxLayout); //(getContentPane(), BoxLayout.Y_AXIS));
// Set up the jtable in a Scroll Pane..
enginesModel = new EnginesTableModel();
//sorter = new TableSorter(enginesModel);
sorter = new QSortFilterProxyModel();
sorter->setSourceModel(enginesModel);
enginesTable = new JTable(sorter);
//sorter.setTableHeader(enginesTable.getTableHeader());
// enginesPane = new JScrollPane(enginesTable);
// enginesPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
enginesModel->initTable(enginesTable, this);
// load the number of engines and listen for changes
numEngines->setText(QString::number(engineManager->getNumEntries()));
//engineManager.addPropertyChangeListener(this);
connect(engineManager->pcs, SIGNAL(propertyChange(PropertyChangeEvent*)), this, SLOT(propertyChange(PropertyChangeEvent*)));
textEngines->setText(tr("engines"));
// Set up the control panel
// row 1
QGroupBox* cp1 = new QGroupBox();
//cp1.setBorder(BorderFactory.createTitledBorder(tr("SortBy")));
QString gbStyleSheet = "QGroupBox { border: 2px solid gray; border-radius: 3px;} QGroupBox::title { /*background-color: transparent;*/ subcontrol-position: top left; /* position at the top left*/ padding:0 0px;} ";
cp1->setStyleSheet(gbStyleSheet);
FlowLayout * cp1Layout = new FlowLayout(cp1);
cp1->setTitle(tr("Sort By"));
cp1Layout->addWidget(sortByNumber);
cp1Layout->addWidget(sortByRoad);
cp1Layout->addWidget(sortByModel);
cp1Layout->addWidget(sortByConsist);
cp1Layout->addWidget(sortByLocation);
cp1Layout->addWidget(sortByDestination);
cp1Layout->addWidget(sortByTrain);
QFrame* movep = new QFrame();
//movep.setBorder(BorderFactory.createTitledBorder(""));
FlowLayout * movepLayout = new FlowLayout(movep);
movepLayout->addWidget(sortByMoves);
movepLayout->addWidget(sortByBuilt);
movepLayout->addWidget(sortByOwner);
if (Setup::isValueEnabled()) {
movepLayout->addWidget(sortByValue);
}
if (Setup::isRfidEnabled()) {
movepLayout->addWidget(sortByRfid);
}
movepLayout->addWidget(sortByLast);
cp1Layout->addWidget(movep);
// row 2
QWidget* cp2 = new QWidget();
//cp2.setLayout(new BoxLayout(cp2, BoxLayout.X_AXIS));
QHBoxLayout* cp2Layout = new QHBoxLayout(cp2);
QFrame* cp2Add = new QFrame();
//cp2Add.setBorder(BorderFactory.createTitledBorder(""));
cp2Add->setFrameShape(QFrame::StyledPanel);
cp2Add->setFrameShadow(QFrame::Raised);
QHBoxLayout* cp2AddLayout = new QHBoxLayout(cp2Add);
//.........这里部分代码省略.........
示例2: QGroupBox
CConfCore::CConfCore( const char *sDev, const char *sName, const char *sAon, int nMixPlata, int nMaxActivePorts, int nPartys, QWidget *parent ) : QGroupBox(parent)
{
m_pOwner = qobject_cast<CConfSMPClient*>(parent);
if(!m_pOwner)
QCoreApplication::exit(EXIT_FAILURE);
QTextCodec *codec = QTextCodec::codecForName("Windows-1251");
QString name = codec->toUnicode(sName);
if(name.isEmpty())
name = QString::number(m_pOwner->pOwner()->m_nVirtLink);
QString title;
title = name;
title += '@';
QString connected = m_pOwner->pOwner()->m_sHost;
if(m_pOwner->pOwner()->m_nPort != 10011)
{
connected += ':';
connected += QString::number(m_pOwner->pOwner()->m_nPort);
}
title += connected;
title += " (";
title += sDev;
title += ')';
setAlignment(Qt::AlignHCenter);
setTitle(title);
QString tooltip;
tooltip += tr("Название");
tooltip += ": ";
tooltip += name;
tooltip += '\n';
tooltip += tr("Номер");
tooltip += ": ";
tooltip += sAon;
tooltip += '\n';
tooltip += tr("Подключен");
tooltip += ": ";
tooltip += connected;
tooltip += '\n';
tooltip += tr("Слот");
tooltip += ": ";
tooltip += QString::number(m_pOwner->pOwner()->m_nVirtLink - 768);
tooltip += '\n';
tooltip += tr("Плата");
tooltip += ": ";
tooltip += QString::number(nMixPlata);
tooltip += '\n';
tooltip += tr("Максимум активных");
tooltip += ": ";
tooltip += QString::number(nMaxActivePorts);
setToolTip(tooltip);
m_nMaxActivePorts = nMaxActivePorts;
#ifdef ANDROID
FlowLayout* pLayout = new FlowLayout(6, 10, 7);
#else
FlowLayout* pLayout = new FlowLayout(8, 8, 6);
#endif
for(int i = 0; i < nPartys; i++)
{
CConfParty* party = new CConfParty(this);
m_pPartys.push_back(party);
pLayout->addWidget(party);
}
QVBoxLayout* pTopLayout = new QVBoxLayout;
QScrollArea* scrl = new QScrollArea();
#ifdef ANDROID
QScroller::grabGesture(scrl, QScroller::LeftMouseButtonGesture);
QScroller* s = QScroller::scroller(scrl);
QScrollerProperties p = s->scrollerProperties();
p.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy, QScrollerProperties::OvershootAlwaysOff);
p.setScrollMetric(QScrollerProperties::VerticalOvershootPolicy, QScrollerProperties::OvershootAlwaysOff);
p.setScrollMetric(QScrollerProperties::OvershootDragDistanceFactor, 0);
p.setScrollMetric(QScrollerProperties::OvershootScrollDistanceFactor, 0);
//p.setScrollMetric(QScrollerProperties::OvershootDragResistanceFactor, 0.9);
//p.setScrollMetric(QScrollerProperties::DragStartDistance, 0.001 );
//p.setScrollMetric(QScrollerProperties::ScrollingCurve, QEasingCurve::Linear );
//p.setScrollMetric(QScrollerProperties::AxisLockThreshold, 0.9);
//Does this help?
//p.setScrollMetric(QScrollerProperties::SnapTime, 1);
//p.setScrollMetric(QScrollerProperties::SnapPositionRatio, 1);
//p.setScrollMetric(QScrollerProperties::AcceleratingFlickSpeedupFactor, 2.5);
//p.setScrollMetric(QScrollerProperties::AcceleratingFlickMaximumTime, 1.25);
s->setScrollerProperties(p);
#endif
QWidget* wgt = new QWidget();
//.........这里部分代码省略.........
示例3: QFrame
CaptureDialog::CaptureDialog(ICaptureContext &ctx, OnCaptureMethod captureCallback,
OnInjectMethod injectCallback, MainWindow *main, QWidget *parent)
: QFrame(parent), ui(new Ui::CaptureDialog), m_Ctx(ctx), m_Main(main)
{
ui->setupUi(this);
ui->exePath->setFont(Formatter::PreferredFont());
ui->workDirPath->setFont(Formatter::PreferredFont());
ui->cmdline->setFont(Formatter::PreferredFont());
ui->processList->setFont(Formatter::PreferredFont());
// setup FlowLayout for options group
{
QLayout *oldLayout = ui->optionsGroup->layout();
QObjectList options = ui->optionsGroup->children();
options.removeOne((QObject *)oldLayout);
delete oldLayout;
FlowLayout *optionsFlow = new FlowLayout(ui->optionsGroup, -1, 3, 3);
optionsFlow->setFixedGrid(true);
for(QObject *o : options)
optionsFlow->addWidget(qobject_cast<QWidget *>(o));
ui->optionsGroup->setLayout(optionsFlow);
}
ui->envVar->setEnabled(false);
m_ProcessModel = new QStandardItemModel(0, 3, this);
m_ProcessModel->setHeaderData(0, Qt::Horizontal, tr("Name"));
m_ProcessModel->setHeaderData(1, Qt::Horizontal, tr("PID"));
m_ProcessModel->setHeaderData(2, Qt::Horizontal, tr("Window Title"));
QSortFilterProxyModel *proxy = new QSortFilterProxyModel(this);
proxy->setSourceModel(m_ProcessModel);
// filter on all columns
proxy->setFilterKeyColumn(-1);
// allow updating the underlying model
proxy->setDynamicSortFilter(true);
// use case-insensitive filtering
proxy->setFilterCaseSensitivity(Qt::CaseInsensitive);
ui->processList->setModel(proxy);
ui->processList->setAlternatingRowColors(true);
// sort by PID by default
ui->processList->sortByColumn(1, Qt::AscendingOrder);
// Set up warning for host layer config
initWarning(ui->vulkanLayerWarn);
ui->vulkanLayerWarn->setVisible(RENDERDOC_NeedVulkanLayerRegistration(NULL, NULL, NULL));
QObject::connect(ui->vulkanLayerWarn, &RDLabel::clicked, this,
&CaptureDialog::vulkanLayerWarn_mouseClick);
// Set up scanning for Android apps
initWarning(ui->androidScan);
// Set up warning for Android apps
initWarning(ui->androidWarn);
QObject::connect(ui->androidWarn, &RDLabel::clicked, this, &CaptureDialog::androidWarn_mouseClick);
m_AndroidFlags = AndroidFlags::NoFlags;
m_CaptureCallback = captureCallback;
m_InjectCallback = injectCallback;
SetSettings(CaptureSettings());
UpdateGlobalHook();
}