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// Qt-Security score:significant reason:default
4
6
7#include <QtWidgets/qmenu.h>
8
9#include <QtGui/qaction.h>
10
11#include <QtCore/qabstractitemmodel.h>
12
14
15namespace qdesigner_internal {
16
17PreviewWidget::PreviewWidget(QWidget *parent)
18 : QWidget(parent)
19{
20 ui.setupUi(this);
21 ui.treeWidget->expandAll();
22 auto model = ui.treeWidget->model();
23 ui.treeWidget->setCurrentIndex(model->index(0, 0, model->index(0, 0)));
24 auto toolButtonMenu = new QMenu(ui.menuToolButton);
25 toolButtonMenu->addAction(tr("Option 1"));
26 toolButtonMenu->addSeparator();
27 auto checkable = toolButtonMenu->addAction(tr("Checkable"));
28 checkable->setCheckable(true);
29 ui.menuToolButton->setMenu(toolButtonMenu);
30 ui.menuToolButton->setPopupMode(QToolButton::InstantPopup);
31}
32
33PreviewWidget::~PreviewWidget() = default;
34
35} // namespace qdesigner_internal
36
37QT_END_NAMESPACE
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.