mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-01 23:02:23 +08:00
qt 6.5.1 original
This commit is contained in:
23
examples/qmake/precompile/main.cpp
Normal file
23
examples/qmake/precompile/main.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
//! [0]
|
||||
#include <QApplication>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include "myobject.h"
|
||||
#include "mydialog.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
MyObject obj;
|
||||
MyDialog dialog;
|
||||
|
||||
dialog.connect(dialog.aButton, SIGNAL(clicked()), SLOT(close()));
|
||||
dialog.show();
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
//! [0]
|
10
examples/qmake/precompile/mydialog.cpp
Normal file
10
examples/qmake/precompile/mydialog.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
#include "mydialog.h"
|
||||
|
||||
MyDialog::MyDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
}
|
17
examples/qmake/precompile/mydialog.h
Normal file
17
examples/qmake/precompile/mydialog.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 MYDIALOG_H
|
||||
#define MYDIALOG_H
|
||||
|
||||
#include "ui_mydialog.h"
|
||||
|
||||
class MyDialog : public QDialog, public Ui::MyDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MyDialog(QWidget *parent = nullptr);
|
||||
};
|
||||
|
||||
#endif
|
47
examples/qmake/precompile/mydialog.ui
Normal file
47
examples/qmake/precompile/mydialog.ui
Normal file
@ -0,0 +1,47 @@
|
||||
<ui version="4.0" >
|
||||
<author></author>
|
||||
<comment></comment>
|
||||
<exportmacro></exportmacro>
|
||||
<class>MyDialog</class>
|
||||
<widget class="QDialog" name="MyDialog" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>401</width>
|
||||
<height>70</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Mach 2!</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="aLabel" >
|
||||
<property name="text" >
|
||||
<string>Join the life in the fastlane; - PCH enable your project today! -</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="aButton" >
|
||||
<property name="text" >
|
||||
<string>&Quit</string>
|
||||
</property>
|
||||
<property name="shortcut" >
|
||||
<string>Alt+Q</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
20
examples/qmake/precompile/myobject.cpp
Normal file
20
examples/qmake/precompile/myobject.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
//! [0]
|
||||
#include <iostream>
|
||||
#include <QDebug>
|
||||
#include <QObject>
|
||||
#include "myobject.h"
|
||||
|
||||
MyObject::MyObject()
|
||||
: QObject()
|
||||
{
|
||||
std::cout << "MyObject::MyObject()\n";
|
||||
}
|
||||
//! [0]
|
||||
|
||||
MyObject::~MyObject()
|
||||
{
|
||||
qDebug() << "MyObject::~MyObject()";
|
||||
}
|
18
examples/qmake/precompile/myobject.h
Normal file
18
examples/qmake/precompile/myobject.h
Normal file
@ -0,0 +1,18 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
#ifndef MYOBJECT_H
|
||||
#define MYOBJECT_H
|
||||
|
||||
//! [0]
|
||||
#include <QObject>
|
||||
|
||||
class MyObject : public QObject
|
||||
{
|
||||
public:
|
||||
MyObject();
|
||||
~MyObject();
|
||||
};
|
||||
//! [0]
|
||||
|
||||
#endif
|
23
examples/qmake/precompile/precompile.pro
Normal file
23
examples/qmake/precompile/precompile.pro
Normal file
@ -0,0 +1,23 @@
|
||||
#############################################
|
||||
#
|
||||
# Example for using Precompiled Headers
|
||||
#
|
||||
#############################################
|
||||
#! [0]
|
||||
TEMPLATE = app
|
||||
LANGUAGE = C++
|
||||
CONFIG += cmdline precompile_header
|
||||
QT += widgets
|
||||
|
||||
# Use Precompiled headers (PCH)
|
||||
PRECOMPILED_HEADER = stable.h
|
||||
|
||||
HEADERS = stable.h \
|
||||
mydialog.h \
|
||||
myobject.h
|
||||
SOURCES = main.cpp \
|
||||
mydialog.cpp \
|
||||
myobject.cpp \
|
||||
util.cpp
|
||||
FORMS = mydialog.ui
|
||||
#! [0]
|
15
examples/qmake/precompile/stable.h
Normal file
15
examples/qmake/precompile/stable.h
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
//! [0]
|
||||
/* Add C includes here */
|
||||
|
||||
#if defined __cplusplus
|
||||
/* Add C++ includes here */
|
||||
|
||||
# include <iostream>
|
||||
# include <QApplication>
|
||||
# include <QPushButton>
|
||||
# include <QLabel>
|
||||
#endif
|
||||
//! [0]
|
12
examples/qmake/precompile/util.cpp
Normal file
12
examples/qmake/precompile/util.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
//! [0]
|
||||
void util_function_does_nothing()
|
||||
{
|
||||
// Nothing here...
|
||||
int x = 0;
|
||||
++x;
|
||||
}
|
||||
//! [0]
|
||||
|
12
examples/qmake/tutorial/hello.cpp
Normal file
12
examples/qmake/tutorial/hello.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
#include <QDebug>
|
||||
#include "hello.h"
|
||||
|
||||
MyPushButton::MyPushButton(const QString &text)
|
||||
: QPushButton(text)
|
||||
{
|
||||
setObjectName("mypushbutton");
|
||||
qDebug() << "My PushButton has been constructed";
|
||||
}
|
10
examples/qmake/tutorial/hello.h
Normal file
10
examples/qmake/tutorial/hello.h
Normal file
@ -0,0 +1,10 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
class MyPushButton : public QPushButton
|
||||
{
|
||||
public:
|
||||
MyPushButton(const QString &text);
|
||||
};
|
5
examples/qmake/tutorial/hellounix.cpp
Normal file
5
examples/qmake/tutorial/hellounix.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
// This file does nothing, but check your Makefile to see if there is a
|
||||
// reference to hello_win.cpp - there shouldn't be if qmake is used on X11.
|
5
examples/qmake/tutorial/hellowin.cpp
Normal file
5
examples/qmake/tutorial/hellowin.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
// This file does nothing, but check your Makefile to see if there is a
|
||||
// reference to hello_x11.cpp - there shouldn't be if qmake is used on Windows.
|
16
examples/qmake/tutorial/main.cpp
Normal file
16
examples/qmake/tutorial/main.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
#include <QApplication>
|
||||
#include "hello.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
MyPushButton helloButton("Hello world!");
|
||||
helloButton.resize(100, 30);
|
||||
|
||||
helloButton.show();
|
||||
return app.exec();
|
||||
}
|
Reference in New Issue
Block a user