-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
a simple cmake-qt demo with out doxygen.
- Loading branch information
Yue-Lan
committed
May 27, 2019
1 parent
6252050
commit 5db3b86
Showing
7 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
|
||
project(demo) | ||
|
||
find_package(Qt5 ${QT_MINIMUM_VERSION} REQUIRED COMPONENTS Core Widgets) | ||
|
||
set(CMAKE_AUTOMOC TRUE) | ||
set(CMAKE_AUTOUIC ON) | ||
set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
|
||
add_subdirectory(src) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
aux_source_directory(. DIR_SRCS) | ||
add_executable(demo ${DIR_SRCS}) | ||
|
||
target_link_libraries(${PROJECT_NAME} Qt5::Widgets) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <QApplication> | ||
#include "mylistview.h" | ||
|
||
int main (int argc, char *argv[]) { | ||
QApplication a(argc, argv); | ||
|
||
MyListView *view = new MyListView; | ||
view->show (); | ||
|
||
return a.exec(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include "mylistmodel.h" | ||
|
||
MyListModel::MyListModel (){ | ||
this->setRootPath("/usr/share"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#ifndef MY_LIST_MODEL_H | ||
#define MY_LIST_MODEL_H | ||
|
||
#include <QFileSystemModel> | ||
|
||
class MyListModel : public QFileSystemModel { | ||
public: | ||
MyListModel (); | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include "mylistview.h" | ||
|
||
MyListView::MyListView () { | ||
this->model = new MyListModel; | ||
this->setModel (this->model); | ||
this->setRootIndex (this->model->index (this->model->rootPath())); | ||
} | ||
|
||
MyListView::~MyListView () { | ||
delete this->model; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef MY_LIST_VIEW_H | ||
#define MY_LIST_VIEW_H | ||
|
||
#include <QListView> | ||
#include "mylistmodel.h" | ||
|
||
class MyListView : public QListView { | ||
public: | ||
MyListView (); | ||
~MyListView (); | ||
|
||
private: | ||
MyListModel *model; | ||
}; | ||
|
||
#endif |