Skip to content

Commit 1d3680c

Browse files
xiugai
1 parent 3a8d922 commit 1d3680c

File tree

8 files changed

+21
-65
lines changed

8 files changed

+21
-65
lines changed

qt_clion/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ set(REQUIRED_LIBS Core Gui Widgets)
1111
set(REQUIRED_LIBS_QUALIFIED Qt5::Core Qt5::Gui Qt5::Widgets)
1212

1313
if(WIN32)
14-
set(CMAKE_PREFIX_PATH "D:/software/Qt5.13.0/mingw73_64/lib/cmake/Qt5")
14+
set(CMAKE_PREFIX_PATH D:/software/Qt5.13.0/mingw73_64/lib/cmake/Qt5)
1515
else()
1616
set(CMAKE_PREFIX_PATH "/usr/lib/x86_64-linux-gnu/cmake/Qt5")
1717
endif()

qt_driview/main.cpp

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,11 @@
1-
/****************************************************************************
2-
**
3-
** Copyright (C) 2016 The Qt Company Ltd.
4-
** Contact: https://www.qt.io/licensing/
5-
**
6-
** This file is part of the examples of the Qt Toolkit.
7-
**
8-
** $QT_BEGIN_LICENSE:BSD$
9-
** Commercial License Usage
10-
** Licensees holding valid commercial Qt licenses may use this file in
11-
** accordance with the commercial license agreement provided with the
12-
** Software or, alternatively, in accordance with the terms contained in
13-
** a written agreement between you and The Qt Company. For licensing terms
14-
** and conditions see https://www.qt.io/terms-conditions. For further
15-
** information use the contact form at https://www.qt.io/contact-us.
16-
**
17-
** BSD License Usage
18-
** Alternatively, you may use this file under the terms of the BSD license
19-
** as follows:
20-
**
21-
** "Redistribution and use in source and binary forms, with or without
22-
** modification, are permitted provided that the following conditions are
23-
** met:
24-
** * Redistributions of source code must retain the above copyright
25-
** notice, this list of conditions and the following disclaimer.
26-
** * Redistributions in binary form must reproduce the above copyright
27-
** notice, this list of conditions and the following disclaimer in
28-
** the documentation and/or other materials provided with the
29-
** distribution.
30-
** * Neither the name of The Qt Company Ltd nor the names of its
31-
** contributors may be used to endorse or promote products derived
32-
** from this software without specific prior written permission.
33-
**
34-
**
35-
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
36-
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
37-
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
38-
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
39-
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40-
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41-
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
42-
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
43-
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44-
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
45-
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
46-
**
47-
** $QT_END_LICENSE$
48-
**
49-
****************************************************************************/
50-
511
#include <QApplication>
522
#include <QDesktopWidget>
533
#include <QFileSystemModel>
544
#include <QFileIconProvider>
555
#include <QTreeView>
566
#include <QCommandLineParser>
577
#include <QCommandLineOption>
8+
#include <QDir>
589

5910
int main(int argc, char *argv[])
6011
{

qt_driview/qt_driview.pro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ QT += core gui
88

99
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
1010

11+
requires(qtConfig(treeview))
12+
1113
TARGET = qt_driview
1214
TEMPLATE = app
1315

qt_screenshot/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ endif()
6464

6565
add_executable(${PROJECT_NAME}
6666
main.cpp
67-
mainwindow.cpp)
67+
fireshot.cpp)
6868

6969
target_include_directories(${PROJECT_NAME}
7070
PUBLIC ./

qt_screenshot/mainwindow.cpp renamed to qt_screenshot/fireshot.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44

55
// You may need to build the project (run Qt uic code generator) to get "ui_MainWindow.h" resolved
66

7-
#include "mainwindow.h"
7+
#include "fireshot.h"
88
#include "ui_mainwindow.h"
99

1010

11-
MainWindow::MainWindow(QWidget *parent) :
12-
QMainWindow(parent), ui(new Ui::MainWindow) {
11+
FireShot::FireShot(QWidget *parent) :
12+
QMainWindow(parent), ui(new Ui::FireShot) {
1313
ui->setupUi(this);
1414
}
1515

16-
MainWindow::~MainWindow() {
16+
FireShot::~FireShot() {
1717
delete ui;
1818
}
1919

qt_screenshot/mainwindow.h renamed to qt_screenshot/fireshot.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@
99

1010

1111
QT_BEGIN_NAMESPACE
12-
namespace Ui { class MainWindow; }
12+
namespace Ui { class FireShot; }
1313
QT_END_NAMESPACE
1414

15-
class MainWindow : public QMainWindow {
15+
class FireShot : public QMainWindow {
1616
Q_OBJECT
1717

1818
public:
19-
explicit MainWindow(QWidget *parent = nullptr);
19+
explicit FireShot(QWidget *parent = nullptr);
2020

21-
~MainWindow() override;
21+
~FireShot() override;
2222

2323
private:
24-
Ui::MainWindow *ui;
24+
Ui::FireShot *ui;
2525
};
2626

2727

qt_screenshot/main.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
#include <QApplication>
22
#include <QPushButton>
33

4-
#include "mainwindow.h"
4+
#include "fireshot.h"
55

66
int main(int argc, char *argv[]) {
77
QApplication a(argc, argv);
8+
// close all windows not close app
9+
a.setQuitOnLastWindowClosed(false);
10+
811
QPushButton button("Hello world!", nullptr);
912
button.resize(200, 100);
1013
button.show();

qt_screenshot/mainwindow.ui

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<ui version="4.0">
3-
<class>MainWindow</class>
4-
<widget class="QMainWindow" name="MainWindow">
3+
<class>FireShot</class>
4+
<widget class="QMainWindow" name="FireShot">
55
<property name="geometry">
66
<rect>
77
<x>0</x>
@@ -11,7 +11,7 @@
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
14-
<string>MainWindow</string>
14+
<string>FireShot</string>
1515
</property>
1616
</widget>
1717
<resources/>

0 commit comments

Comments
 (0)