Selaa lähdekoodia

first commit

master
hex 5 vuotta sitten
commit
9fd81dde48
  1. 15
      CMakeLists.txt
  2. 17
      include/window.h
  3. 11
      src/main.cpp
  4. 20
      src/window.cpp

15
CMakeLists.txt

@ -0,0 +1,15 @@ @@ -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
include/window.h

@ -0,0 +1,17 @@ @@ -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
src/main.cpp

@ -0,0 +1,11 @@ @@ -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
src/window.cpp

@ -0,0 +1,20 @@ @@ -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)));
}
}
Ladataan…
Peruuta
Tallenna