Jump to content

  • Log In with Google      Sign In   
  • Create Account

- - - - -

Ox - Window Framework

Posted by , 04 May 2012 · 832 views

[source lang="cpp"]#include <windows.h>#include "OxApplication.h"#include "OxWidget.h"#include "OxMainWindow.h"#include "OxPushButton.h"class Window : public Ox::MainWindow{public: Window();private: void changeTitle(Object *sender){ setWindowTitle("Clicked!"); } Ox::PushButton *button;};Window::Window(){ button = new Ox::PushButton("Button", centralWidget()); connect(button->clicked, &Window::changeTitle); resize(Ox::Size(300, 300)); setWindowTitle("Ox::Widget Test");}int WINAPI WinMain(HINSTANCE hIn, HINSTANCE, LPSTR cmdLine, int show){ Ox::Application app; Window mainWindow; app.connect(mainWindow.destroyed, &Ox::Application::exit); mainWindow.show(); return app.exec();}[/source]

So my latest random for-fun project is the most infeasible yet - a Qt-inspired Win32 wrapper. It'll never work. It's stupid.

Most interesting part really is the reimplementation from scratch of the old type-safe signals/slots mechanism with templates. Quite happy with the syntax for connecting. Ox::Object under the hood maintains a list of Slot objects so that disconnection is automatic when the owing object goes out of scope.

The only annoyance is that I have to have Ox::Signal, Ox::Signal1<T1>, Ox::Signal2<T1, T2> etc. Be really nice if there was some way of just having Ox::Signal<T1, T2> etc but I gather that isn't possible.

Not really a template metaprogrammer so quite pleased to have got it working anyway. Current stupid plan is to develop this to the point where its sort of vaguely working, then use it to re-write Opus, the 3D modeller, from scratch as I'm bored with the current version and want all the goodness I get from Qt at work without all the hassle of, y'know, actually having to use Qt.

Stupid plan, stupid project, stupid idea.

Qt is awesome, clean, neat, and powerful. The only probably with writing code in Qt is that it makes your/my code anything but clean, neat, and powerful. Posted Image

Somehow, as neat and well-thoughtout the Qt libraries are, it always makes the parts of my code that use it feel cludgy and messy. Maybe I have trouble embracing Qt paradynes or something.

Your library is looking good!
Yeah, I kinda agree, although at work where cross-platform is an actual requirement rather than a buzzword as its used on the forums here, its pretty invaluable to be able to so easily stay within the Qt arena for pretty much everything.

My project is purely for fun. I don't ever expect it to be more than 1% Qt-feature complete but I'm hoping to start developing a project with it when the basics are working, then add to it as I go.

Trackbacks for this entry [ Trackback URL ]

There are no Trackbacks for this entry

January 2017 »

151617181920 21

Recent Entries

Recent Comments

Recent Entries

Recent Comments