Browse Source

first commit

master
hex 4 years ago
commit
9fd81dde48
4 changed files with 63 additions and 0 deletions
  1. 15
    0
      CMakeLists.txt
  2. 17
    0
      include/window.h
  3. 11
    0
      src/main.cpp
  4. 20
    0
      src/window.cpp

+ 15
- 0
CMakeLists.txt View File

@@ -0,0 +1,15 @@
cmake_minimum_required (VERSION 3.6)
project ("hexfm")
file (GLOB_RECURSE SOURCES "src/*.cpp")
include_directories("./include")

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_EXPORT_COMPILE_COMMANDS on)
set(CMAKE_AUTOMOC on)
add_executable(hexfm ${SOURCES})

set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(Threads REQUIRED)
find_package(Qt5Widgets)
target_link_libraries(hexfm Qt5::Widgets ${CMAKE_THREAD_LIBS_INIT})


+ 17
- 0
include/window.h View File

@@ -0,0 +1,17 @@
#pragma once

#include <QWidget>

class QPushButton;
class QListView;
class QStandardItemModel;

class Window : public QWidget {
public:
explicit Window(QWidget *parent = 0);

private:
QPushButton *mButton;
QListView *mListView;
QStandardItemModel *mModel;
};

+ 11
- 0
src/main.cpp View File

@@ -0,0 +1,11 @@
#include <QApplication>
#include "window.h"
int main(int argc, char **argv)
{
QApplication app (argc, argv);

Window window;
window.show();

return app.exec();
}

+ 20
- 0
src/window.cpp View File

@@ -0,0 +1,20 @@
#include "window.h"

#include <QPushButton>
#include <QListView>
#include <QStandardItemModel>
#include <QString>

Window::Window(QWidget *parent) :
QWidget(parent)
{
mListView = new QListView(this);
mButton = new QPushButton("add", this);

mModel = new QStandardItemModel();
mListView->setModel(mModel);

for (int i = 1; i <= 10; ++i) {
mModel->appendRow(new QStandardItem(QString(i)));
}
}

Loading…
Cancel
Save