mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-06 17:25:24 +08:00
qt 6.5.1 original
This commit is contained in:
@ -0,0 +1,30 @@
|
||||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
qt_add_executable(styleplugin
|
||||
main.cpp
|
||||
stylewindow.cpp stylewindow.h
|
||||
)
|
||||
|
||||
set_target_properties(styleplugin PROPERTIES
|
||||
WIN32_EXECUTABLE TRUE
|
||||
MACOSX_BUNDLE TRUE
|
||||
)
|
||||
|
||||
target_link_libraries(styleplugin PRIVATE
|
||||
Qt6::Core
|
||||
Qt6::Gui
|
||||
Qt6::Widgets
|
||||
)
|
||||
|
||||
if(NOT QT6_IS_SHARED_LIBS_BUILD)
|
||||
target_link_libraries(styleplugin PRIVATE
|
||||
simplestyleplugin
|
||||
)
|
||||
endif()
|
||||
|
||||
install(TARGETS styleplugin
|
||||
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
)
|
26
examples/widgets/tools/styleplugin/stylewindow/main.cpp
Normal file
26
examples/widgets/tools/styleplugin/stylewindow/main.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
#include <QApplication>
|
||||
#include <QStyleFactory>
|
||||
|
||||
#include "stylewindow.h"
|
||||
|
||||
//! [0]
|
||||
int main(int argv, char *args[])
|
||||
{
|
||||
QApplication app(argv, args);
|
||||
|
||||
QStyle *style = QStyleFactory::create("simplestyle");
|
||||
if (!style)
|
||||
qFatal("Cannot load the 'simplestyle' plugin.");
|
||||
|
||||
QApplication::setStyle(style);
|
||||
|
||||
StyleWindow window;
|
||||
window.resize(350, 50);
|
||||
window.show();
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
//! [0]
|
@ -0,0 +1,25 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QTextEdit>
|
||||
|
||||
#include "stylewindow.h"
|
||||
|
||||
StyleWindow::StyleWindow()
|
||||
{
|
||||
QTextEdit *styledTextEdit = new QTextEdit(tr("The quick brown fox jumps over the lazy dog"));
|
||||
|
||||
QGridLayout *layout = new QGridLayout;
|
||||
layout->addWidget(styledTextEdit);
|
||||
|
||||
QGroupBox *styleBox = new QGroupBox(tr("A simple styled text edit"));
|
||||
styleBox->setLayout(layout);
|
||||
|
||||
QGridLayout *outerLayout = new QGridLayout;
|
||||
outerLayout->addWidget(styleBox, 0, 0);
|
||||
setLayout(outerLayout);
|
||||
|
||||
setWindowTitle(tr("Style Plugin Example"));
|
||||
}
|
17
examples/widgets/tools/styleplugin/stylewindow/stylewindow.h
Normal file
17
examples/widgets/tools/styleplugin/stylewindow/stylewindow.h
Normal file
@ -0,0 +1,17 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
#ifndef STYLEWINDOW_H
|
||||
#define STYLEWINDOW_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class StyleWindow : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
StyleWindow();
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,19 @@
|
||||
QT += widgets
|
||||
|
||||
HEADERS = stylewindow.h
|
||||
SOURCES = stylewindow.cpp \
|
||||
main.cpp
|
||||
|
||||
TARGET = styleplugin
|
||||
win32 {
|
||||
debug:DESTDIR = ../debug/
|
||||
release:DESTDIR = ../release/
|
||||
} else {
|
||||
DESTDIR = ../
|
||||
}
|
||||
|
||||
# install
|
||||
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/styleplugin
|
||||
INSTALLS += target
|
||||
|
||||
CONFIG += install_ok # Do not cargo-cult this!
|
Reference in New Issue
Block a user