Skip to content
  • 0 Votes
    2 Posts
    244 Views
    Pl45m4P

    @giorgik63 said in How to read selected value in widget properties in Qt Designer?:

    value selected in a list of elements shown in a property of a custom widget placed in Qt Designer

    Can you explain or show what list you mean?

    Edit:

    Seems to be related to this topic and will probably get answered there.

    https://forum.qt.io/topic/144783/how-to-manage-choice-item-property-my-plugin-in-qt-6-5
  • 0 Votes
    7 Posts
    2k Views
    Sh1gsS

    @SGaist

    Ok, after fiddling around with debugging and testing things, I believe I have solved it. So my thought process was the user inputs an IP Address 123.123.123.123 and before closing the popup numberpad, clicks on the different LineEdits to change the IP Mask 123.15.16.5. That is why I was checking if(num->isVisible()) because then it would close/delete/popup each time a LineEdit is clicked. I was having problems/segmentation faults because after the user clicks "Done" (or presses Enter/Return on the keyboard), the popup is deleted so checking isVisible()) resulted in errors.

    To fix this, I created a boolean value numVis that is true if the numberpad is visible, and false otherwise. It is this value that I am now checking and everything seems to work just fine. I hope this makes sense.

    I will go ahead and mark this as solved.

  • 0 Votes
    4 Posts
    1k Views
    mrjjM

    @Sh1gs
    Just as a note.
    There is no difference adding widgets in code or adding via Designer.
    The setupUI() as seen in mainwindow ctor creates the Designer widgets as code.

    So the only true difference is handwritten versus generated from UI file.
    Also adding via Designer, gives easier translations as the translate function is generated for the user.

  • 0 Votes
    5 Posts
    8k Views
    Sh1gsS

    Thank you @mrjj

    I will go ahead and mark this as solved then. I know my IP Editor isn't exactly elegant, but with the requirements I'm given and the restrictions, I've done the best I can.

  • 0 Votes
    7 Posts
    3k Views
    EddyE

    Thanks for posting your solution.

    Happy coding.

  • 0 Votes
    1 Posts
    760 Views
    No one has replied
  • 0 Votes
    5 Posts
    4k Views
    T

    I just tried the latest Qt 5.5 release an the Qt Creator that comes with this release. At least on Windows the QtQuick.Extras work out of the box. If you use an older Qt Creator the Extras are not part of Qt Creator and you have to build the qml2puppet as described above.

    For your own components which use C++ you should always build the qml2puppet.

  • 0 Votes
    2 Posts
    4k Views
    CybrumC

    I found a solution. I followed the below Steps:
    1.Created a QtCreator Extension Plugin
    2.In Pro file: Add
    uri = mycompany.qmlcomponents
    version =1.0

    3.Added my CustomControl QML file.
    4.Registered using qmlRegisterType
    5.In qml dir:
    module mycompany.qmlcomponents
    plugin MyExtensionPlugin
    classname MyExtensionPlugin
    typeinfo mycompany.qmlcomponents
    designersupported
    5.Wrote the MetaInfo file (myextensionplugin.metainfo):
    MetaInfo {
    Type {
    name: "mycompany.qmlcomponents.MyCustomItem"
    icon: "images/customitem-icon.png"

    ItemLibraryEntry { name: "CustomItem" category: "My Extension - Items" libraryIcon: "images/customitem-icon.png" version: "1.0" requiredImport: "mycompany.qmlcomponents" Property { name: "itemItext" type: "binding" value: "qsTr(\"Button\")" } } } }

    6.Create a designer folder
    7.Add following to designer.pri
    QML_FILES +=
    $$PWD/CustomItemSpecifics.qml
    QML_FILES += $$PWD/myextensionplugin.metainfo
    QML_FILES +=
    $$PWD/images/customitem-icon.png
    8.Build and install
    9.Generate qmltypes: [You can also do this during qmake]
    qmlplugindump mycompany.qmlcomponents1.0 > plugins.qmltypes
    10.The controls will be available in the qml designer.

    Check the unsupported properties for custom controls:
    http://doc.qt.io/qtcreator/creator-quick-ui-forms.html