本文整理汇总了C++中QDockWidget::pos方法的典型用法代码示例。如果您正苦于以下问题:C++ QDockWidget::pos方法的具体用法?C++ QDockWidget::pos怎么用?C++ QDockWidget::pos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDockWidget
的用法示例。
在下文中一共展示了QDockWidget::pos方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: settings
void MainWindow2::writeSettings()
{
QSettings settings("Pencil", "Pencil");
settings.setValue("editorPosition", pos());
settings.setValue("editorSize", size());
Palette* colourPalette = m_colorPalette;
if (colourPalette != NULL)
{
settings.setValue("colourPalettePosition", colourPalette->pos());
settings.setValue("colourPaletteSize", colourPalette->size());
settings.setValue("colourPaletteFloating", colourPalette->isFloating());
}
TimeLine* timelinePalette = editor->getTimeLine();
if (timelinePalette != NULL)
{
settings.setValue("timelinePalettePosition", timelinePalette->pos());
settings.setValue("timelinePaletteSize", timelinePalette->size());
settings.setValue("timelinePaletteFloating", timelinePalette->isFloating());
}
QDockWidget* toolWidget = editor->toolSet;
if (toolWidget != NULL)
{
settings.setValue("drawPalettePosition", toolWidget->pos());
settings.setValue("drawPaletteSize", toolWidget->size());
settings.setValue("drawPaletteFloating", toolWidget->isFloating());
}
QDockWidget* optionPalette = m_toolOptionWidget;
if (optionPalette != NULL)
{
settings.setValue("optionPalettePosition", optionPalette->pos());
settings.setValue("optionPaletteSize", optionPalette->size());
settings.setValue("optionPaletteFloating", optionPalette->isFloating());
}
QDockWidget* displayPalette = m_displayOptionWidget;
if (displayPalette != NULL)
{
settings.setValue("displayPalettePosition", displayPalette->pos());
settings.setValue("displayPaletteSize", displayPalette->size());
settings.setValue("displayPaletteFloating", displayPalette->isFloating());
}
}
示例2: setFloating
void tst_QDockWidget::setFloating()
{
const QRect deskRect = QApplication::desktop()->availableGeometry();
QMainWindow mw;
mw.move(deskRect.left() + deskRect.width() * 2 / 3, deskRect.top() + deskRect.height() / 3);
QDockWidget dw;
mw.addDockWidget(Qt::LeftDockWidgetArea, &dw);
mw.show();
QVERIFY(QTest::qWaitForWindowExposed(&mw));
QVERIFY(!dw.isFloating());
const QPoint dockedPosition = dw.mapToGlobal(dw.pos());
QSignalSpy spy(&dw, SIGNAL(topLevelChanged(bool)));
dw.setFloating(true);
const QPoint floatingPosition = dw.pos();
// QTBUG-31044, show approximately at old position, give or take window frame.
QVERIFY((dockedPosition - floatingPosition).manhattanLength() < 50);
QVERIFY(dw.isFloating());
QCOMPARE(spy.count(), 1);
QCOMPARE(spy.at(0).value(0).toBool(), dw.isFloating());
spy.clear();
dw.setFloating(dw.isFloating());
QCOMPARE(spy.count(), 0);
spy.clear();
dw.setFloating(false);
QVERIFY(!dw.isFloating());
QCOMPARE(spy.count(), 1);
QCOMPARE(spy.at(0).value(0).toBool(), dw.isFloating());
spy.clear();
dw.setFloating(dw.isFloating());
QCOMPARE(spy.count(), 0);
spy.clear();
}