View Full Version : using arthurwidgets.h and arthurwidgets.cpp?

19th August 2006, 05:06
i've looked everywhere to see how to write a main window, dialog, or just label ->show the widget style used in the arthur demos apps in qt4. so far i've read the docs and it seems that it would be a custom style issue, however no dice so far. i need info as to whether i call arthurwidgets.cpp as a style or whatever... any assistance or kick in the right direction would be appreciated. thanks in advanced

19th August 2006, 12:37
Look at the demos using those widgets. In their main() there is something like this:

QStyle *arthurStyle = new ArthurStyle();

QList<QWidget *> widgets = qFindChildren<QWidget *>(&compWidget);
foreach (QWidget *w, widgets)

The first line does most of the magic (loads the style). Then this code sets the style to some widgets in the application. If you want to set the style for all widgets in an application, you can use QApplication::setStyle instead.

The style is defined in demos/shared/arthurstyle.{h,cpp} in your QTDIR.

21st August 2006, 01:52
however i got this error:

g++ -pthread -Wl,-rpath,/usr/local/Trolltech/Qt-4.1.4/lib -o experiment main.o arthurwidgets.o arthurstyle.o moc_arthurwidgets.o -L/usr/local/lib -L/usr/local/Trolltech/Qt-4.1.4/lib -lQtGui_debug -L/qt-x11-opensource-src-4.1.4/lib -L/usr/local/lib -L/usr/X11R6/lib -lpng -lSM -lICE -lXi -lXrender -lXrandr -lXcursor -lXinerama -lfreetype -lfontconfig -lXext -lX11 -lQtCore_debug -lz -lm
arthurstyle.o(.text+0x29b): In function `ArthurStyle::ArthurStyle()':
../shared/arthurstyle.cpp:53: undefined reference to `qInitResources_shared()'
arthurstyle.o(.text+0x2e7): In function `ArthurStyle::ArthurStyle()':
../shared/arthurstyle.cpp:53: undefined reference to `qInitResources_shared()'
*** Error code 1

as you can see it begins during linking and the corresponding line in arthurstyle.cpp:

: QWindowsStyle()
Q_INIT_RESOURCE(shared); //culprit on line 53

i haven't a clue as to what this is referencing ... i'll start looking through the headers after
i take a break. could be the .pro file is missing dependency? i'll write again in a little while.

21st August 2006, 02:46
okay qmake macro expansion, didn't know you could do that from a source file... i got it to build and i now see that i should take a good look at the .pri .pro and .qrc in the shared folder. i'm actually building my first real app so i really appreciate all the help. thanks again. :D