Results 1 to 4 of 4

Thread: using arthurwidgets.h and arthurwidgets.cpp?

  1. #1
    Join Date
    Aug 2006
    Location
    troy, new york
    Posts
    24
    Thanks
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default using arthurwidgets.h and arthurwidgets.cpp?

    hey,
    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

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: using arthurwidgets.h and arthurwidgets.cpp?

    Look at the demos using those widgets. In their main() there is something like this:

    Qt Code:
    1. QStyle *arthurStyle = new ArthurStyle();
    2. compWidget.setStyle(arthurStyle);
    3.  
    4. QList<QWidget *> widgets = qFindChildren<QWidget *>(&compWidget);
    5. foreach (QWidget *w, widgets)
    6. w->setStyle(arthurStyle);
    To copy to clipboard, switch view to plain text mode 
    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.

  3. #3
    Join Date
    Aug 2006
    Location
    troy, new york
    Posts
    24
    Thanks
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: using arthurwidgets.h and arthurwidgets.cpp?

    thanks,
    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:

    ArthurStyle::ArthurStyle()
    : 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.

  4. #4
    Join Date
    Aug 2006
    Location
    troy, new york
    Posts
    24
    Thanks
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: using arthurwidgets.h and arthurwidgets.cpp?

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.