Skip to content

aoloe/cpp-libui-qtlike

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libui-qtlike

Qt-like library for libui.

libui is a C lightweight multi-platform UI library using native widgets on Linux (Gtk), OS X, and Windows.
libui-qtlike provides a C++ interface to libui

Instead of inventing a new class design, the interface is as close as possible to the Qt one.
As a welcome side effect it should be easier to start a project with libui and -- if the project gets bigger and needs a more powerful library -- switch to Qt.

Of course, the UI of a libui-qtlike program will not look like Qt, except if you are using the Qt backend (which is not in libui yet).

For small projects, using libui will produce much smaller executables for Windows and OS X.

The initial implementation aims at getting one of the basic Qt examples to run: http://doc.qt.io/qt-5/qtwidgets-mainwindows-application-example.html

Current state

Currently, it's possible to create a main window with a menu:

#include "libui-qtlike/libui-qtlike.h"
#include <vector>

using namespace std;

class MainWindow : public UI::MainWindow
{
public:
    MainWindow();
private:
    void createActions();
};

MainWindow::MainWindow()
{
    createActions();
}

void MainWindow::createActions()
{
    UI::Menu *fileMenu = menuBar()->addMenu("_File");
    UI::Action *newAction = new UI::Action("_New", this);
    fileMenu->addAction(newAction);
}

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

    UI::Application app(argc, argv);

    MainWindow mainWin;
    mainWin.show();
    return app.exec();
}

Building

On Linux:

  • compile libui and copy the .h and .so files in the libui/ directory

  • compile and run the example:

    mkdir build/
    cd build/
    cmake ..
    make
    ./main-window

Differences to Qt

  • The Q from the Qt classes is replaced by the UI namespace.
  • Only UI feataures of Qt are implemented.
  • There won't be more features than what libui provides.

Todo

Next tasks

  • add the quit menu entry

Other tasks

Long term

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published