Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. combobox
    Log in to post
    • All categories
    • CJha

      Unsolved How to set QStyle::SH_ComboBox_Popup to false?
      General and Desktop • qstyle combobox fusion • • CJha

      6
      0
      Votes
      6
      Posts
      238
      Views

      CJha

      @raven-worx For me, it seems as it is working. The above code is actually taken from ProxyStyle web page from Qt's website, I just replaced QStyle::SH_UnderlineShortcut with QStyle::SH_ComboBox_Popup. So, I think it is a good approach.

      Subclassing QComboBox would become quite cumbersome as I will have to promote all the combo boxes in my UI to the subclass.

    • CJha

      Unsolved QComboBox and smart pointer conflict?
      General and Desktop • combobox smart pointers exception • • CJha

      9
      0
      Votes
      9
      Posts
      195
      Views

      S

      @CJha said in QComboBox and smart pointer conflict?:

      But in any case I would like to make sure that it is destroyed before the application exits.

      In general this is a good approach. When you write clean code all resources should be freed by your own application (typically RAII in C++). However, when your application closes the OS will free all memory belonging to the application and removes all file handles of the application. Especially in complex applications it can take quite a while to clean up everything in order. In those cases it is a lot more userfriendly to just exit without the clean up. So, don't worry too much about clean up. Still, you should understand why this happens and how it can be avoided.

    • Z

      Unsolved Combo Box problem in QGIS
      Tools • qt designer qgis combobox • • zouzou

      2
      0
      Votes
      2
      Posts
      164
      Views

      SGaist

      Hi and welcome to devnet,

      Without a minimal code example showing what you do it's not possible to see what might be wrong.

    • T

      Unsolved read value from combo box to c++ function
      QML and Qt Quick • qml c++ combobox signal signal & slot • • texasRanger

      5
      0
      Votes
      5
      Posts
      349
      Views

      GrecKo

      @texasRanger said in read value from combo box to c++ function:

      I have been trying to connect the qml signal of the combo box being changed to the itemChanged slot in c++. but I have had no luck.

      Don't do that.
      Do like in the link posted by SGaist.

      Some links about the reason why you shouldn't reach into QML from C++:

      https://doc.qt.io/qt-5/qtquick-bestpractices.html#interacting-with-qml-from-c
      http://doc.qt.io/qt-5/qtqml-cppintegration-overview.html#interacting-with-qml-objects-from-c
      https://youtu.be/vzs5VPTf4QQ?t=23m20s

    • M

      Unsolved Connecting the index of a combobox to a model
      C++ Gurus • modelview model binding combobox model combobox gui • • Mikkel

      5
      0
      Votes
      5
      Posts
      370
      Views

      fcarney

      If you use the the same model instance in more than one place they will always have the same index. This may, or may not be what you want. FYI

    • A

      Unsolved How to properly style QComboBox and dropdown?
      General and Desktop • stylesheet combobox style combobox macos drop-down combobox • • arjun98

      3
      0
      Votes
      3
      Posts
      306
      Views

      A

      @nagesh No style sheet, however, I had experiemented with the stylesheet in the link that you sent, and I couldn't figure it out. Which fields pertain to the width of the drop-down?

      There is a horizontal layout, however, I have also tried without layout and I get the same issue.
      I can control the width of the Combobox when it is closed, but once open there is an offset, that is what I would like to remove.

      Thank you,
      Arjun

    • D

      Unsolved Open the selected port
      General and Desktop • serial port qt5 combobox • • deleted286

      5
      0
      Votes
      5
      Posts
      244
      Views

      Pablo J. Rogina

      @suslucoder said in Open the selected port:

      I solved it, you can delete my post.

      No, the solved posts don't get deleted. They remain for the benefit of other forum users having same/similar issues.
      It's a community driven approach, opposite to a "my problem only" driven approach

    • D

      Unsolved Open the port which selected on combo box
      General and Desktop • combobox serial port qt5 • • deleted286

      10
      0
      Votes
      10
      Posts
      960
      Views

      jsulm

      @suslucoder I don't see why it would not be possible to select other entries in a combo box. Do you do anything else with ui->ports?

    • K

      Solved Using editable ComboBox
      QML and Qt Quick • editablcombobox combobox • • koahnig

      4
      0
      Votes
      4
      Posts
      289
      Views

      K

      Thought initially that the issue could be completely solved in qml, but Settings seem to miss some features as present in QSettings. Therefore decided to move forward with solution based on C++ with QML.

      https://forum.qt.io/topic/120954/combobox-together-with-qstringlistmodel

    • C

      Solved Dynamically add combo box without resetting the previous selection
      General and Desktop • qml combobox listmodel • • chilarai

      5
      0
      Votes
      5
      Posts
      695
      Views

      C

      @JonB alright.I will remember that

    • H

      Unsolved why show Popup function of comboBox is not working?
      General and Desktop • combobox • • Himanshu Meena

      2
      0
      Votes
      2
      Posts
      184
      Views

      B

      count() just return the number of items as the result, what do you expect it to work?
      showPopup() should be called on the combo box, so ui->comboBox->showPopup().
      Are you also new to C++? Feels like you need learn some basics first.

    • T

      Unsolved Cannot interact with my ui widgets from a self defined slots
      General and Desktop • widget combobox signals & slots • • TUStudi

      4
      0
      Votes
      4
      Posts
      249
      Views

      SGaist

      Your BluetoothController should have a member variable of the BluetoothModel class.
      Your BluetoothModel class should provide an API that your BluetoothController can connect to and also that provides whatever data is needed.

    • B

      Unsolved ComboBox on a page in a StackView causes an assert failure in AddConnection
      QML and Qt Quick • qml combobox stackview assert qt 5.9.1 • • Brian K.

      2
      0
      Votes
      2
      Posts
      301
      Views

      B

      Update: I downloaded the most recent version of Qt, 5.13.0, and I could not get the issue to repeat. So I think the problem is related to specific versions of Qt.

    • G

      Solved PlaceHolder in ComboBox
      QML and Qt Quick • combobox placeholder • • gabor53

      2
      0
      Votes
      2
      Posts
      613
      Views

      G

      I figured it out:

      displayText: currentIndex === -1 ? "Choose ..." : currentIndex
    • S

      Solved ComboBox delegate on QSqlRelationalTableModel: setModelData?
      General and Desktop • combobox delegate relationaltable • • see_mountains

      2
      0
      Votes
      2
      Posts
      803
      Views

      S

      Ok, I have figured it out by myself. The key was looking at the comboBoxModel->data and getting the index from rows and coloumns. That's my solution:

      void comboBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const { if(QComboBox *cb = qobject_cast<QComboBox*>(editor)) { QString cbText = cb->currentText(); int vpe_index = -1; for (int row = 0; row < comboBoxModel->rowCount() ; row++) { if (comboBoxModel->data(comboBoxModel->index(row, 0)) == cbText){ vpe_index = comboBoxModel->data(comboBoxModel->index(row, 1)).toInt(); } } if (vpe_index == -1) { qDebug() << "Index not found"; } else { qDebug() << "Index set: " << model->setData(index, vpe_index, Qt::EditRole); } } else { QStyledItemDelegate::setModelData(editor, model, index); } }
    • K

      Solved changing combobox index when selection of another combobox is changed
      QML and Qt Quick • qml combobox • • koahnig

      9
      0
      Votes
      9
      Posts
      5794
      Views

      J.Hilk

      @koahnig said in changing combobox index when selection of another combobox is changed:

      Probably a really stupid question: Why do I need "===" and not "==" ?

      Because you want to be really really sure that they are equal x)

      No, JavaScript does conversion checks as well

      "1" == 1 -> true
      "1" === 1 -> false

      And I love C++!!!

      hear,hear!

    • N

      Solved QWidget not response on ComboBox action
      General and Desktop • qwidget combobox signal & slot • • nebulaekg

      4
      0
      Votes
      4
      Posts
      480
      Views

      Christian Ehrlicher

      I said 'Maybe you've a typo...'
      The problem with auto-connect is that you can not be sure if it is really connected (e.g. when there is a typo somewhere in the functions signature or the ui element name) and it easily breaks (e.g. when renaming an ui element).

    • K

      Solved Choose directory from combobox and list subdirectories in textedit
      General and Desktop • qt5.5.0 combobox list textedit • • Kinesis

      5
      0
      Votes
      5
      Posts
      1764
      Views

      K

      @aha_1980
      It works ! Thanks alot
      :)

    • P

      Unsolved QML ComboBox Popup Issue
      QML and Qt Quick • qml qtquick2 combobox • • pra7

      1
      0
      Votes
      1
      Posts
      1001
      Views

      No one has replied