Code Monkey home page Code Monkey logo

bookfiler-widget-qt-sort-filter-tree's Introduction

BookFiler Library: Sort Filter Tree Widget

This is a QT5 widget that creates a QTreeView with sorting and filtering functionality with a sqlite3 backend.

Usage Instructions

Connect to your database:

sqlite3 *dbPtr = nullptr;
sqlite3_open(":memory:", &dbPtr);
// Using shared pointers when possible
std::shared_ptr<sqlite3> database(nullptr);
database.reset(dbPtr, sqlite3_close);

Create the tree widget and set the database data

  // Create View and Model
  std::shared_ptr<bookfiler::widget::TreeView> treeViewPtr =
      std::make_shared<bookfiler::widget::TreeView>();
  std::shared_ptr<bookfiler::widget::TreeModel> treeModelPtr =
      std::make_shared<bookfiler::widget::TreeModel>();
  qtMainWindow.setCentralWidget(treeViewPtr.get());
  qtMainWindow.show();

  // Setup Model
  treeModelPtr->setData(database, "testTable", "guid", "parent_guid");
  treeModelPtr->setRoot("*");

  // Setup View
  treeViewPtr->setModel(treeModelPtr.get());
  treeViewPtr->update();

Table format

This widget will work with any sqlite3 table as long as there is a guid and parent_guid column. The guid is a unique id for the row and the parent_guid will be the parent id that the row will be a child of.

Example

columns: guid, parent_guid, Subject, Important, Attachment, From, Date, Size

Style 1

Build Instructions

Windows - MinGW-w64

Install MSYS2
Then, install GCC, cmake, git and dependencies. Confirmed working with Windows 10 as of 11/19/2020.

pacman -Syu
pacman -S mingw-w64-x86_64-gcc git make mingw-w64-x86_64-cmake
pacman -Rns cmake
# restart MSYS2 so that we use the mingw cmake
pacman -S mingw-w64-x86_64-boost mingw-w64-x86_64-sqlite3

Build:

git clone https://github.com/bradosia/BookFiler-Lib-Sort-Filter-Tree-Widget
cd BookFiler-Module-HTTP
mkdir build
cd build
cmake -G "MSYS Makefiles" ../
make

Linux Ubuntu

Install GCC, cmake, git and dependencies. Confirmed working with Ubuntu 20.04 as of 11/8/2020.

sudo apt-get update
sudo apt install build-essential gcc-multilib g++-multilib cmake git
sudo apt install libboost-all-dev mingw-w64-x86_64-sqlite3

Build:

git clone https://github.com/bradosia/BookFiler-Lib-Sort-Filter-Tree-Widget
cd BookFiler-Module-HTTP
mkdir build
cd build
cmake ../
make

Developers

Developer Notes

bookfiler-widget-qt-sort-filter-tree's People

Contributors

bradosia avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.