Page 2 of 2 FirstFirst 12
Results 21 to 32 of 32

Thread: Properly adding custom widget into Qt Designer

  1. #21
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Properly adding custom widget into Qt Designer

    You can build the custom widget into a library and link both the applicaton and the designer plugin to it.

    Cheers,
    _

  2. #22
    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: Properly adding custom widget into Qt Designer

    Quote Originally Posted by Baltharos View Post
    So I need to.. Link the resulting library and header file into new projects?
    Same like with any other lib you use.

    Changes the .pro file to include the folder of the dll project?
    I don't understand what you mean.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #23
    Join Date
    Jan 2015
    Posts
    22
    Thanks
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Properly adding custom widget into Qt Designer

    Well, I tried to link in the .pro file. I made folder "includes" in which goes the header files, put the resulting .lib file into the new project folder (and the dll into the plugins/designer folder), and put some lines in the .pro file like this:

    INCLUDEPATH += "C:\Qt\CTablegunakan\includes"
    LIBS += "C:\Qt\CTablegunakan\ntablewplugin.lib"

    and the custom functions went error again..

  4. #24
    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: Properly adding custom widget into Qt Designer

    You are using incorrect syntax for the LIBS variable. It should be -L directoryname -l libraryname
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #25
    Join Date
    Jan 2015
    Posts
    22
    Thanks
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Properly adding custom widget into Qt Designer

    LIBS += -L$$_PRO_FILE_PWD_ -lntablewplugin
    LIBS += -LD:\CTablegunakan -lntablewplugin

    don't work. I'm confused. If I'm not wrong, $$_PRO_FILE_PWD_ means the full directory path of the .pro file right? -L command can also be used for windows?

  6. #26
    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: Properly adding custom widget into Qt Designer

    Check the compiler output to see the actual linker line being ivoked. See if the linker gets proper arguments for your library.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #27
    Join Date
    Jan 2015
    Posts
    22
    Thanks
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Properly adding custom widget into Qt Designer

    The result for the debug is this :

    Qt Code:
    1. 11:26:11: Running steps for project CTablegunakan...
    2. 11:26:11: Configuration unchanged, skipping qmake step.
    3. 11:26:11: Starting: "E:\Qt\Qt5.3.0\Tools\mingw482_32\bin\mingw32-make.exe"
    4. E:/Qt/Qt5.3.0/Tools/mingw482_32/bin/mingw32-make -f Makefile.Debug
    5. mingw32-make[1]: Entering directory 'D:/build-CTablegunakan-Desktop_Qt_5_3_0_MinGW_32bit-Debug'
    6. g++ -Wl,-subsystem,windows -mthreads -o debug\CTablegunakan.exe debug/main.o debug/mainwindow.o debug/moc_mainwindow.o -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -lqtmaind -LD:/CTablegunakan -lntablewplugin -LE:/Qt/Qt5.3.0/5.3/mingw482_32/lib -lQt5Widgetsd -lQt5Guid -lQt5Cored
    7. debug/mainwindow.o: In function `ZN10MainWindow21on_pushButton_clickedEv':
    8. D:\build-CTablegunakan-Desktop_Qt_5_3_0_MinGW_32bit-Debug/../CTablegunakan/mainwindow.cpp:60: undefined reference to `NTableW::setHeaderTrue(bool, QStringList)'
    9. D:\build-CTablegunakan-Desktop_Qt_5_3_0_MinGW_32bit-Debug/../CTablegunakan/mainwindow.cpp:61: undefined reference to `NTableW::setSiderowTrue(bool)'
    10. debug/mainwindow.o: In function `ZN10MainWindow21on_checkBox_4_clickedEb':
    11. D:\build-CTablegunakan-Desktop_Qt_5_3_0_MinGW_32bit-Debug/../CTablegunakan/mainwindow.cpp:87: undefined reference to `NTableW::freezeRow(int)'
    12. D:\build-CTablegunakan-Desktop_Qt_5_3_0_MinGW_32bit-Debug/../CTablegunakan/mainwindow.cpp:89: undefined reference to `NTableW::isFrozen()'
    13. D:\build-CTablegunakan-Desktop_Qt_5_3_0_MinGW_32bit-Debug/../CTablegunakan/mainwindow.cpp:90: undefined reference to `NTableW::unfreezeRow()'
    14. debug/mainwindow.o: In function `ZN10MainWindow21on_checkBox_5_clickedEb':
    15. D:\build-CTablegunakan-Desktop_Qt_5_3_0_MinGW_32bit-Debug/../CTablegunakan/mainwindow.cpp:100: undefined reference to `NTableW::isHeaderHidden()'
    16. debug/mainwindow.o: In function `ZN13Ui_MainWindow7setupUiEP11QMainWindow':
    17. D:\build-CTablegunakan-Desktop_Qt_5_3_0_MinGW_32bit-Debug/./ui_mainwindow.h:118: undefined reference to `NTableW::NTableW(QWidget*)'
    18. collect2.exe: error: ld returned 1 exit status
    19. Makefile.Debug:80: recipe for target 'debug\CTablegunakan.exe' failed
    20. mingw32-make[1]: *** [debug\CTablegunakan.exe] Error 1
    21. mingw32-make: *** [debug] Error 2
    22. mingw32-make[1]: Leaving directory 'D:/build-CTablegunakan-Desktop_Qt_5_3_0_MinGW_32bit-Debug'
    23. Makefile:34: recipe for target 'debug' failed
    24. 11:26:13: The process "E:\Qt\Qt5.3.0\Tools\mingw482_32\bin\mingw32-make.exe" exited with code 2.
    25. Error while building/deploying project CTablegunakan (kit: Desktop Qt 5.3.0 MinGW 32bit)
    26. When executing step 'Make'
    To copy to clipboard, switch view to plain text mode 

    Is this line wrong?
    g++ -Wl,-subsystem,windows -mthreads -o debug\CTablegunakan.exe debug/main.o debug/mainwindow.o debug/moc_mainwindow.o -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -lqtmaind -LD:/CTablegunakan -lntablewplugin -LE:/Qt/Qt5.3.0/5.3/mingw482_32/lib -lQt5Widgetsd -lQt5Guid -lQt5Cored

  8. #28
    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: Properly adding custom widget into Qt Designer

    Where is your plugin located? Is it built in release or debug mode? Did you remember to export the NTableW class using Q_DECL_EXPORT or similar?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #29
    Join Date
    Jan 2015
    Posts
    22
    Thanks
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Properly adding custom widget into Qt Designer

    Sorry for taking so long to reply. It's built in release mode (the plugin). Where do I have to put in Q_DECL_EXPORT? I've only seen it in QT library template, not custom Designer widget template.

  10. #30
    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: Properly adding custom widget into Qt Designer

    You are building a library. You want to link your application with your custom widget code, don't you?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. #31
    Join Date
    Jan 2015
    Posts
    22
    Thanks
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Properly adding custom widget into Qt Designer

    Yeah, I finally got it to work (can access the library now). How do I connect the library to widget?

  12. #32
    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: Properly adding custom widget into Qt Designer

    I have no idea what "connecting the library to widget" means.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 7
    Last Post: 18th August 2011, 15:43
  2. Replies: 1
    Last Post: 24th June 2011, 00:09
  3. Custom widget won't size properly in a table cell
    By zeroknowledge in forum Qt Programming
    Replies: 1
    Last Post: 11th May 2011, 17:32
  4. Adding Custom Widgets to the QT Designer
    By Polnareff in forum Qt Programming
    Replies: 1
    Last Post: 17th May 2010, 22:31
  5. Simple custom widget won't size properly
    By MrGarbage in forum Qt Tools
    Replies: 2
    Last Post: 9th August 2007, 14:12

Tags for this Thread

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.