Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
previewwidget.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
5
6#include <QtWidgets/qmenu.h>
7
8#include <QtGui/qaction.h>
9
10#include <QtCore/qabstractitemmodel.h>
11
13
14namespace qdesigner_internal {
15
16PreviewWidget::PreviewWidget(QWidget *parent)
17 : QWidget(parent)
18{
19 ui.setupUi(this);
20 ui.treeWidget->expandAll();
21 auto model = ui.treeWidget->model();
22 ui.treeWidget->setCurrentIndex(model->index(0, 0, model->index(0, 0)));
23 auto toolButtonMenu = new QMenu(ui.menuToolButton);
24 toolButtonMenu->addAction(tr("Option 1"));
25 toolButtonMenu->addSeparator();
26 auto checkable = toolButtonMenu->addAction(tr("Checkable"));
27 checkable->setCheckable(true);
28 ui.menuToolButton->setMenu(toolButtonMenu);
29 ui.menuToolButton->setPopupMode(QToolButton::InstantPopup);
30}
31
32PreviewWidget::~PreviewWidget() = default;
33
34} // namespace qdesigner_internal
35
36QT_END_NAMESPACE
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.