Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. List of custom widgets in QtCreator
Forum Updated to NodeBB v4.3 + New Features

List of custom widgets in QtCreator

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 796 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    julienangel
    wrote on last edited by
    #1

    Hey Guys,

    So my question is:

    I am trying to create a custom widget(small example: a widget with 3 labels), but for each widget, I would change the text on the 3 labels.

    And then I would like to insert into a list of widgets.

    I tried alot this, but I can’t find a proper tutorial or something.

    If you guys could help me would be so much awesome!

    Thank you!
    Cheers

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi and welcome to the forums.
      First Question is :
      do you want to create a real custom widget for using in Designer ?
      Like
      http://doc.qt.io/qt-5/designer-creating-custom-widgets.html
      This requires/have some rules about compiler used.

      Or do mean just to create a reusable setup of some widget and be able to reuse them in
      other projects ? It would not need to add new properties from the custom widget
      as all properties comes from default QWidgets ?
      This one is super easy,
      Just create the widget how u want it in Designer and simple select it and drag to the widget list
      It will be listed under scratchpad in the list.

      option 3 is
      You create a custom widget and use promotion feature of Creator
      http://doc.qt.io/qt-5/designer-using-custom-widgets.html
      This is basically like
      add a qwidget to the form.
      Right click and select promote
      tell it class name of the customWidget
      tell it .h where to find this class
      click Add and then Promote
      When you then run app. the Qwidget is now your custom widget.
      Think of it as placeholder feature. U add normal QWidget but when run its your
      custom Widget.
      This allows to use in Design mode but you cannot have editable properties
      directly in Designer.

      Ah update
      My clever friend Luca made me realize i read your question all wrong.
      If u want a list of widgets with 3 labels, you should look into
      QListview and delegates
      since labes are just text you might not even need a delegate so a
      ListView/LstWidget should just do it for u.
      if u want each cell to have like 3 texts, then delegate is needed.
      see here for delegate
      http://doc.qt.io/qt-5/qitemdelegate.html
      http://doc.qt.io/qt-5/qtwidgets-itemviews-stardelegate-example.html

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved