本文整理汇总了C++中QMargins函数的典型用法代码示例。如果您正苦于以下问题:C++ QMargins函数的具体用法?C++ QMargins怎么用?C++ QMargins使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QMargins函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: HelpWidget
void MetadataDialog::build()
{
HelpWidget *help = new HelpWidget(32, tr("Pour être placées dans le Cloud, "
"les sauvegardes doivent être signées. "
"Ces signatures sont écrites dans un fichier "
"nommé metadata.xml, normalement situé "
"dans le même dossier que vos sauvegardes.\n"
"Pour trouver votre numéro d'utilisateur, "
"regardez le nom du dossier où se trouve vos sauvegardes. "
"Si vous ne voyez pas, essayez en laissant le champ vide.\n"
"Par défaut Hyne tente de signer les sauvegardes "
"automatiquement, mais en cas d'erreur, vous pouvez "
"essayer de le faire manuellement ici."));
_path = new QLineEdit(this);
_pathButton = new QPushButton(tr("Parcourir..."), this);
QHBoxLayout *pathLayout = new QHBoxLayout;
pathLayout->addWidget(_path);
pathLayout->addWidget(_pathButton);
pathLayout->setContentsMargins(QMargins());
_userID = new QLineEdit(this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
Qt::Horizontal, this);
connect(buttonBox, SIGNAL(accepted()), SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), SLOT(reject()));
_formWidget = new QWidget(this);
QFormLayout *formLayout = new QFormLayout(_formWidget);
formLayout->addRow(tr("metadata.xml"), pathLayout);
formLayout->addRow(tr("Numéro d'utilisateur"), _userID);
formLayout->setContentsMargins(QMargins());
QVBoxLayout *layout = new QVBoxLayout(this);
layout->addWidget(help);
layout->addWidget(_formWidget);
layout->addStretch();
layout->addWidget(buttonBox);
connect(_pathButton, SIGNAL(clicked()), SLOT(setMetadataPath()));
}
开发者ID:kaniini,项目名称:hyne,代码行数:45,代码来源:MetadataDialog.cpp
示例2: timeView
TimeWidget::TimeWidget(TimeView& timeView) : timeView(timeView), lastTimeInfoTimeStamp(0)
{
table = new QTableWidget();
table->setColumnCount(4);
QStringList headerNames;
headerNames << "Stopwatch" << "Min" << "Max" << "Avg";
table->setHorizontalHeaderLabels(headerNames);
table->verticalHeader()->setVisible(false);
table->verticalHeader()->setResizeMode(QHeaderView::Fixed);
table->verticalHeader()->setDefaultSectionSize(15);
table->horizontalHeader()->setResizeMode(3, QHeaderView::Stretch);
table->setEditTriggers(QAbstractItemView::NoEditTriggers);
table->setAlternatingRowColors(true);
table->setSortingEnabled(true);
table->setShowGrid(false);
//initial sort by name
QVBoxLayout* layout = new QVBoxLayout(this);
QHBoxLayout* filterLayout = new QHBoxLayout();
filterLayout->addWidget(new QLabel(" Filter: "));
QLineEdit* filterEdit = new QLineEdit();
filterEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
filterLayout->addWidget(filterEdit);
filterLayout->setContentsMargins(QMargins());
frequency = new QLabel(" Frequency: ");
layout->setSpacing(0);
layout->addSpacing(2);
layout->addWidget(frequency);
layout->addSpacing(2);
layout->addLayout(filterLayout);
layout->addWidget(table);
layout->setContentsMargins(QMargins());
this->setLayout(layout);
lastTimeInfoTimeStamp = SystemCall::getCurrentSystemTime();
lastUpdate = SystemCall::getCurrentSystemTime();
QObject::connect(filterEdit,SIGNAL(textChanged(QString)),this,SLOT(filterChanged(QString)));
QSettings& settings = RoboCupCtrl::application->getLayoutSettings();
settings.beginGroup(timeView.fullName);
table->horizontalHeader()->restoreState(settings.value("HeaderState").toByteArray());
table->sortItems(settings.value("SortBy").toInt(), (Qt::SortOrder) settings.value("SortOrder").toInt());
filter = settings.value("Filter").toString();
filterEdit->setText(filter);
settings.endGroup();
}
开发者ID:BADBDY23,项目名称:BHumanCodeRelease,代码行数:45,代码来源:TimeWidget.cpp
示例3: KFrameItem
KKSliderVolume::KKSliderVolume( QGraphicsItem *parent /*= NULL*/ )
: KFrameItem(parent)
, m_timerid(0)
{
KWidget *itemParent = qobject_cast<KWidget*>(parent->toGraphicsObject());
QGraphicsView *itemView = itemParent->view();
m_pWindow = new KBubbleTip(itemView);
m_pWindow->setSceneMargins(QMargins(0,0,0,0));
KWidget *root = m_pWindow->rootWidget();
m_sliderPannel = new KFrameItem(root);
root->addItem(m_sliderPannel);
m_sliderPannel->setFrameType(KFrameItem::GridFour);
m_sliderPannel->setLayoutType(KWidget::VBox);
m_sliderFrame = new KSpacer(m_sliderPannel);
m_sliderFrame->setLayoutType(KWidget::VBox);
m_sliderFrame->setGrayToDisable(true);
m_slider = new KSlider(m_sliderFrame);
m_slider->setOrientation(Qt::Vertical);
m_slider->setRange(0, 1.0);
m_mute = new KFrameItem(m_sliderPannel);
m_sliderFrame->addItem(m_slider);
m_sliderPannel->addItem(m_sliderFrame);
m_sliderPannel->addItem(m_mute);
setAcceptHover(true);
m_popupSize = QSize(20,100);
m_mute->setFixHeight(20);
m_mute->setAcceptClick(true);
m_sliderPannel->setMargins(QMargins(0,0,0,0));
m_sliderPannel->setDefaultFrame(KFrameItem::RectWhite);
m_sliderPannel->setFrameType(KFrameItem::GridFour);
m_sliderPannel->setZValue(100);
m_mute->setFrameSwitch(false);
setFrameSwitch(false);
m_pWindow->setTarget(this);
m_pWindow->setDirection(KFollowWindow::TopCenter);
m_pWindow->hide();
QObject::connect(m_mute, SIGNAL(clicked()), this, SLOT(on_mute_clicked()));
QObject::connect(m_slider, SIGNAL(valueChanged(qreal)), this, SIGNAL(valueChanged(qreal)));
}
开发者ID:kxtry,项目名称:kxfw-example,代码行数:45,代码来源:kkslidervolume.cpp
示例4: QMargins
void CFramelessWindow::showFullScreen()
{
if (isMaximized())
{
QMainWindow::setContentsMargins(m_margins);
m_frames = QMargins();
}
QMainWindow::showFullScreen();
}
开发者ID:bao-boyle,项目名称:Qt-Nice-Frameless-Window,代码行数:9,代码来源:framelesswindow.cpp
示例5: QMargins
void QVistaHelper::updateCustomMargins(bool vistaMargins)
{
if (QWindow *window = wizard->windowHandle()) {
// Reduce top frame to zero since we paint it ourselves. Use
// device pixel to avoid rounding errors.
const QMargins customMarginsDp = vistaMargins
? QMargins(0, -titleBarSizeDp(), 0, 0)
: QMargins();
const QVariant customMarginsV = qVariantFromValue(customMarginsDp);
// The dynamic property takes effect when creating the platform window.
window->setProperty("_q_windowsCustomMargins", customMarginsV);
// If a platform window exists, change via native interface.
if (QPlatformWindow *platformWindow = window->handle()) {
QGuiApplication::platformNativeInterface()->
setWindowProperty(platformWindow, QStringLiteral("WindowsCustomMargins"),
customMarginsV);
}
}
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:19,代码来源:qwizard_win.cpp
示例6: g
void AbstractBox::resizeMaxHeight(int32 newWidth, int32 maxHeight) {
if (width() != newWidth || _maxHeight != maxHeight) {
QRect g(geometry());
_maxHeight = maxHeight;
resize(newWidth, countHeight());
if (parentWidget()) {
parentWidget()->update(geometry().united(g).marginsAdded(QMargins(st::boxShadow.pxWidth(), st::boxShadow.pxHeight(), st::boxShadow.pxWidth(), st::boxShadow.pxHeight())));
}
}
}
开发者ID:neuroidss,项目名称:tdesktop,代码行数:10,代码来源:abstractbox.cpp
示例7: createLayout
void CLabel::createLayout()
{
m_pHLayout = new QHBoxLayout;
m_pHLayout->setSpacing(6);
m_pHLayout->setContentsMargins(QMargins(5, 0, 5, 0));
m_pHLayout->addWidget(m_pLabelIcon);
m_pHLayout->addWidget(m_pLabelText);
this->setLayout(m_pHLayout);
}
开发者ID:GuofengLiang,项目名称:360Code,代码行数:10,代码来源:clabel.cpp
示例8: QMargins
QMargins QHaikuWindow::frameMargins() const
{
const BRect decoratorFrame = m_window->DecoratorFrame();
const BRect frame = m_window->Frame();
return QMargins(frame.left - decoratorFrame.left,
frame.top - decoratorFrame.top,
decoratorFrame.right - frame.right,
decoratorFrame.bottom - frame.bottom);
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:10,代码来源:qhaikuwindow.cpp
示例9: QWidget
SimpleCodeStylePreferencesWidget::SimpleCodeStylePreferencesWidget(QWidget *parent) :
QWidget(parent),
m_preferences(0)
{
m_tabSettingsWidget = new TabSettingsWidget(this);
QVBoxLayout *layout = new QVBoxLayout(this);
layout->addWidget(m_tabSettingsWidget);
layout->setContentsMargins(QMargins());
m_tabSettingsWidget->setEnabled(false);
}
开发者ID:OSLL,项目名称:sca,代码行数:10,代码来源:simplecodestylepreferenceswidget.cpp
示例10: enterEvent
void PopupMenu::enterEvent(QEvent *e) {
QPoint mouse = QCursor::pos();
if (!_inner.marginsRemoved(QMargins(0, _st.skip, 0, _st.skip)).contains(mapFromGlobal(mouse))) {
if (_mouseSelection && _childMenuIndex < 0) {
_mouseSelection = false;
setSelected(-1);
}
}
return TWidget::enterEvent(e);
}
开发者ID:MobinRanjbar,项目名称:tdesktop,代码行数:10,代码来源:popupmenu.cpp
示例11: QWidget
QMetaObjectEditor::QMetaObjectEditor(QWidget* parent) : QWidget(parent) {
QVBoxLayout* layout = new QVBoxLayout();
layout->setContentsMargins(QMargins());
layout->setAlignment(Qt::AlignTop);
setLayout(layout);
layout->addWidget(_box = new QComboBox());
connect(_box, SIGNAL(currentIndexChanged(int)), SLOT(updateMetaObject()));
foreach (const QMetaObject* metaObject, Bitstream::getMetaObjectSubClasses(&SharedObject::staticMetaObject)) {
_box->addItem(metaObject->className(), QVariant::fromValue(metaObject));
}
开发者ID:RyanDowne,项目名称:hifi,代码行数:11,代码来源:MetavoxelUtil.cpp
示例12: QWidget
GmacsMainField::GmacsMainField(QWidget *parent) : QWidget(parent)
{
edit_area = new GmacsTextField();
status_bar = new GmacsStatusBar();;
layout = new QVBoxLayout();
layout->setSpacing(0);
layout->setContentsMargins(QMargins(0, 0, 0, 0));
layout->addWidget(edit_area);
layout->addWidget(status_bar);
setLayout(layout);
}
开发者ID:goccy,项目名称:gmacs,代码行数:11,代码来源:GmacsMainField.cpp
示例13: SceneTool
CSVWorld::SceneToolMode::SceneToolMode (SceneToolbar *parent)
: SceneTool (parent), mButtonSize (parent->getButtonSize()), mIconSize (parent->getIconSize())
{
mPanel = new QFrame (this, Qt::Popup);
mLayout = new QHBoxLayout (mPanel);
mLayout->setContentsMargins (QMargins (0, 0, 0, 0));
mPanel->setLayout (mLayout);
}
开发者ID:0xmono,项目名称:openmw,代码行数:11,代码来源:scenetoolmode.cpp
示例14: QVBoxLayout
void TTriadEditor::buildWidget()
{
QVBoxLayout *layout = new QVBoxLayout(this);
tabWidget = new QTabWidget(this);
tabWidget->addTab(buildPage1(), tr("Cartes"));
tabWidget->addTab(buildPage2(), tr("Règles"));
layout->addWidget(tabWidget);
layout->setContentsMargins(QMargins());
}
开发者ID:kaniini,项目名称:hyne,代码行数:11,代码来源:TTriadEditor.cpp
示例15: QDialog
LoadingDialog::LoadingDialog(QWidget *parent) : QDialog(parent)
{
//Modal = true;
setWindowTitle("Loading Route...");
iconArea = new QLabel();
iconArea->setObjectName("iconArea");
iconArea->setFrameStyle(QFrame::StyledPanel);
iconArea->setMinimumSize(QSize(210, 210));
iconArea->setPixmap(QPixmap(":/RWMapMaker/Resources/MapMakerPersp-ico.png"));
iconArea->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop);
logText = new QLabel();
logText->setObjectName("logText");
logText->setFrameStyle(QFrame::StyledPanel);
logText->setMinimumSize(QSize(240, 192));
logText->setMaximumSize(QSize(480, 240));
logText->setAlignment(Qt::AlignLeft|Qt::AlignTop);
logText->setWordWrap(true);
cancelButton = new QPushButton();
cancelButton->setObjectName("cancelButton");
cancelButton->setText("Abort");
cancelButton->setShortcut(QKeySequence("Esc"));
cancelButton->setMinimumSize(QSize(48, 12));
connect(cancelButton, SIGNAL(clicked()), this, SLOT(doAbort()));
progressBar = new QProgressBar();
progressBar->setObjectName("progressBar");
progressBar->setFormat("%v (%p%)");
progressBar->setAlignment(Qt::AlignCenter);
row1Layout = new QHBoxLayout();
row1Layout->setObjectName("row1Layout");
row1Layout->setSpacing(12);
row1Layout->addWidget(iconArea);
row1Layout->addWidget(logText);
row2Layout = new QHBoxLayout();
row2Layout->setObjectName("row2Layout");
row2Layout->setSpacing(12);
row2Layout->addWidget(this->cancelButton);
row2Layout->addStretch(1);
col1Layout = new QVBoxLayout();
col1Layout->setObjectName("col1Layout");
col1Layout->setSpacing(12);
col1Layout->setContentsMargins(QMargins(10,10,10,5));
col1Layout->addLayout(this->row1Layout);
col1Layout->addWidget(this->progressBar);
col1Layout->addLayout(this->row2Layout);
setLayout(col1Layout);
}
开发者ID:rivimey,项目名称:rwmapmaker,代码行数:54,代码来源:LoadingDialog.cpp
示例16: QVBoxLayout
void MiscEditor::buildWidget()
{
QVBoxLayout *layout = new QVBoxLayout(this);
tabWidget = new QTabWidget(this);
tabWidget->addTab(buildPage1(), tr("Divers"));
tabWidget->addTab(buildPage2(), tr("Tutoriel"));
layout->addWidget(tabWidget);
layout->setContentsMargins(QMargins());
}
开发者ID:kaniini,项目名称:hyne,代码行数:11,代码来源:MiscEditor.cpp
示例17: QGraphicsPixmapItem
BackScene::BackScene(ItemCollector *ic, QObject *parent)
:ic(ic) {
this->setSceneRect(ic->getPixmap().rect()-=QMargins(10, 10, 10, 10));
QGraphicsPixmapItem *back = new QGraphicsPixmapItem();
back->setPixmap(QPixmap(ic->getPixmap()));
back->setZValue(-10);
this->addItem(back);
this->setParent(parent);
isPressing = false;
oldPoint = ic->outPoint();
}
开发者ID:ideallx,项目名称:Hexagon,代码行数:11,代码来源:backscene.cpp
示例18: createWaveFormPic
void Record::createWaveFormPic(Ffmpeg_t *ffmpeg, QString recortPath) {
std::pair<std::vector<double>, std::vector<double> > dataWaveForm = ffmpeg->getSamplesForWaveformPlotting(recortPath + "/" + m_Name);
QCustomPlot Plotter;
Plotter.setBackground(QBrush(Qt::transparent) );
Plotter.xAxis->setVisible(false);
Plotter.yAxis->setVisible(false);
Plotter.axisRect()->setAutoMargins(QCP::msNone);
Plotter.axisRect()->setMargins(QMargins(0, 5, 0, 5));
QCPGraph *Waveform = Plotter.addGraph();
Waveform->setPen(QPen(Qt::green) );
if (!Waveform)
{
qDebug("addGraph failed\n");
}
QVector<double> Amplitudes(QVector<double>::fromStdVector(dataWaveForm.first) );
QVector<double> Time;
double CurrentTime = 0;
auto TimeSlotCount = Amplitudes.size();
for (int64_t i = 1; i < TimeSlotCount; i++)
{
Time.append(CurrentTime);
CurrentTime += 0.5;
}
Waveform->setData(Time, Amplitudes);
Plotter.xAxis->setRange(0, Time.back() );
Plotter.yAxis->setRange(SHRT_MIN, SHRT_MAX);
QByteArray ByteArray;
QBuffer Buffer(&ByteArray);
Buffer.open(QBuffer::WriteOnly);
uint32_t time = m_EndTime - m_StartTime;
for (int i = 1; i < 10000; i*=10) {
Plotter.toPixmap(time/(i), this->height()).save(&Buffer, "PNG", 0);
//Plotter.saveJpg(recortPath + "/plot" + QString::number(m_Id) + QString::number(i) + ".jpg", time/(i), this->height());
QPixmap Pixmap;
Pixmap.loadFromData(ByteArray, "PNG");
v_PixWaves.append(Pixmap);
ByteArray.clear();
Buffer.reset();
}
Buffer.close();
qDebug() << m_WavePic->margin();
// místo 2 podle toho jaký zoom
m_WavePic->setPixmap(v_PixWaves[2]);
}
开发者ID:PetrosW,项目名称:pDub,代码行数:54,代码来源:record.cpp
示例19: resetPlot
void MainWindow::genMarginGroup()
{
resetPlot();
customPlot->plotLayout()->clear();
customPlot->plotLayout()->addElement(0, 0, new QCPAxisRect(customPlot));
customPlot->plotLayout()->addElement(0, 1, new QCPAxisRect(customPlot));
customPlot->plotLayout()->addElement(1, 0, new QCPAxisRect(customPlot));
customPlot->plotLayout()->addElement(1, 1, new QCPAxisRect(customPlot));
foreach (QCPAxisRect *r, customPlot->axisRects())
r->axis(QCPAxis::atBottom)->setTickLabels(false);
QCPMarginGroup *marginGroup = new QCPMarginGroup(customPlot);
customPlot->axisRect(0)->setMarginGroup(QCP::msLeft, marginGroup);
customPlot->axisRect(2)->setMarginGroup(QCP::msLeft, marginGroup);
customPlot->axisRect(0)->axis(QCPAxis::atLeft)->setRange(0, 1300);
customPlot->axisRect(1)->axis(QCPAxis::atLeft)->setRange(0, 1300);
customPlot->axisRect(0)->axis(QCPAxis::atLeft)->setLabel("y");
customPlot->axisRect(1)->axis(QCPAxis::atLeft)->setLabel("y");
customPlot->plotLayout()->setAutoMargins(QCP::msLeft|QCP::msRight|QCP::msBottom);
customPlot->plotLayout()->setMargins(QMargins(0, 25, 0, 0));
QFont textFont;
textFont.setBold(true);
QCPItemText *leftCaption = new QCPItemText(customPlot);
customPlot->addItem(leftCaption);
leftCaption->position->setType(QCPItemPosition::ptViewportRatio);
leftCaption->setClipToAxisRect(false);
leftCaption->position->setCoords(0.25, 0);
leftCaption->setPositionAlignment(Qt::AlignTop|Qt::AlignHCenter);
leftCaption->setText("left sides in margin group");
leftCaption->setFont(textFont);
QCPItemText *rightCaption = new QCPItemText(customPlot);
customPlot->addItem(rightCaption);
rightCaption->position->setType(QCPItemPosition::ptViewportRatio);
rightCaption->position->setCoords(0.75, 0);
rightCaption->setClipToAxisRect(false);
rightCaption->setPositionAlignment(Qt::AlignTop|Qt::AlignHCenter);
rightCaption->setText("no margin group");
rightCaption->setFont(textFont);
QCPItemLine *splitter = new QCPItemLine(customPlot);
splitter->start->setType(QCPItemPosition::ptViewportRatio);
splitter->start->setCoords(0.5, 0);
splitter->end->setType(QCPItemPosition::ptViewportRatio);
splitter->end->setCoords(0.5, 1);
splitter->setClipToAxisRect(false);
splitter->setPen(QPen(Qt::gray, 0, Qt::DashLine));
customPlot->savePng(dir.filePath("QCPMarginGroup.png"), 400, 400);
}
开发者ID:pabigot,项目名称:qcustomplot,代码行数:54,代码来源:mainwindow.cpp
示例20: drawBackground
void SearchDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
if (index.data(Qt::AccessibleDescriptionRole).toString() == QLatin1String("configure"))
{
QItemDelegate::paint(painter, option, index);
return;
}
drawBackground(painter, option, index);
if (index.data(Qt::AccessibleDescriptionRole).toString() == QLatin1String("separator"))
{
QStyleOptionFrame frameOption;
frameOption.palette = option.palette;
frameOption.rect = option.rect;
frameOption.state = option.state;
frameOption.frameShape = QFrame::HLine;
QApplication::style()->drawControl(QStyle::CE_ShapedFrame, &frameOption, painter, 0);
return;
}
const int shortcutWidth = ((option.rect.width() > 150) ? 40 : 0);
QRect titleReactangle = option.rect;
if (!index.data(Qt::DecorationRole).value<QIcon>().isNull())
{
QRect decorationRectangle = option.rect;
decorationRectangle.setRight(option.rect.left() + option.rect.height());
decorationRectangle = decorationRectangle.marginsRemoved(QMargins(2, 2, 2, 2));
index.data(Qt::DecorationRole).value<QIcon>().paint(painter, decorationRectangle, option.decorationAlignment);
titleReactangle.setLeft(option.rect.left() + option.rect.height());
}
if (shortcutWidth > 0)
{
titleReactangle.setRight(titleReactangle.right() - (shortcutWidth + 5));
}
drawDisplay(painter, option, titleReactangle, index.data(Qt::UserRole).toString());
if (shortcutWidth > 0)
{
QRect shortcutReactangle = option.rect;
shortcutReactangle.setLeft(option.rect.right() - shortcutWidth);
drawDisplay(painter, option, shortcutReactangle, index.data(Qt::UserRole + 2).toString());
}
}
开发者ID:Kermit,项目名称:otter,代码行数:53,代码来源:SearchDelegate.cpp
注:本文中的QMargins函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论