mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-03 15:55:27 +08:00
6.5.3 clean
This commit is contained in:
@ -0,0 +1,37 @@
|
||||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(part1 LANGUAGES CXX)
|
||||
|
||||
if(NOT DEFINED INSTALL_EXAMPLESDIR)
|
||||
set(INSTALL_EXAMPLESDIR "examples")
|
||||
endif()
|
||||
|
||||
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/addressbook/part1")
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
|
||||
|
||||
qt_standard_project_setup()
|
||||
|
||||
qt_add_executable(part1
|
||||
addressbook.cpp addressbook.h
|
||||
main.cpp
|
||||
)
|
||||
|
||||
set_target_properties(part1 PROPERTIES
|
||||
WIN32_EXECUTABLE TRUE
|
||||
MACOSX_BUNDLE TRUE
|
||||
)
|
||||
|
||||
target_link_libraries(part1 PRIVATE
|
||||
Qt6::Core
|
||||
Qt6::Gui
|
||||
Qt6::Widgets
|
||||
)
|
||||
|
||||
install(TARGETS part1
|
||||
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
|
||||
)
|
@ -0,0 +1,30 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
#include <QtWidgets>
|
||||
#include "addressbook.h"
|
||||
|
||||
//! [constructor and input fields]
|
||||
AddressBook::AddressBook(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
QLabel *nameLabel = new QLabel(tr("Name:"));
|
||||
nameLine = new QLineEdit;
|
||||
|
||||
QLabel *addressLabel = new QLabel(tr("Address:"));
|
||||
addressText = new QTextEdit;
|
||||
//! [constructor and input fields]
|
||||
|
||||
//! [layout]
|
||||
QGridLayout *mainLayout = new QGridLayout;
|
||||
mainLayout->addWidget(nameLabel, 0, 0);
|
||||
mainLayout->addWidget(nameLine, 0, 1);
|
||||
mainLayout->addWidget(addressLabel, 1, 0, Qt::AlignTop);
|
||||
mainLayout->addWidget(addressText, 1, 1);
|
||||
//! [layout]
|
||||
|
||||
//![setting the layout]
|
||||
setLayout(mainLayout);
|
||||
setWindowTitle(tr("Simple Address Book"));
|
||||
}
|
||||
//! [setting the layout]
|
@ -0,0 +1,29 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
#ifndef ADDRESSBOOK_H
|
||||
#define ADDRESSBOOK_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QTextEdit;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
//! [class definition]
|
||||
class AddressBook : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AddressBook(QWidget *parent = nullptr);
|
||||
|
||||
private:
|
||||
QLineEdit *nameLine;
|
||||
QTextEdit *addressText;
|
||||
};
|
||||
//! [class definition]
|
||||
|
||||
#endif
|
@ -0,0 +1,17 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
#include <QtWidgets>
|
||||
#include "addressbook.h"
|
||||
|
||||
//! [main function]
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
AddressBook addressBook;
|
||||
addressBook.show();
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
//! [main function]
|
@ -0,0 +1,11 @@
|
||||
QT += widgets
|
||||
|
||||
SOURCES = addressbook.cpp \
|
||||
main.cpp
|
||||
HEADERS = addressbook.h
|
||||
|
||||
QMAKE_PROJECT_NAME = ab_part1
|
||||
|
||||
# install
|
||||
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/addressbook/part1
|
||||
INSTALLS += target
|
Reference in New Issue
Block a user