Skip to content

Brainstorm

Stuck? Some ideas just need to be dumped on someone before they can materialize.
458 Topics 3.2k Posts
  • Update C++ list model from QML

    Solved
    11
    0 Votes
    11 Posts
    3k Views
    ChronalC
    You can use a QAbstractListModel to update the list model from QML. The QAbstractListModel provides an interface for accessing data from a list of items. It can be used to update the list model from QML by using the setData() method. To update the list model from QML, you will need to create a QAbstractListModel subclass and implement the setData() method. The setData() method should take the index of the item to be updated and the new value for the item. You can then call the setData() method from QML to update the list model. For example, if you have a list of strings, you can create a QAbstractListModel subclass and implement the setData() method as follows: void MyListModel::setData(const QModelIndex &index, const QVariant &value, int role) { if (index.isValid() && role == Qt::EditRole) { int row = index.row(); QStringList list = data(index, Qt::DisplayRole).toStringList(); list[row] = value.toString(); setData(index, QVariant::fromValue(list), Qt::DisplayRole); } } You can then call the setData() method from QML to update the list model. For example: MyListModel { id: myListModel // ... } Button { text: "Update List Model" onClicked: { myListModel.setData(myListModel.index(0, 0), "New Value", Qt.EditRole); } } This will update the first item in the list model with the new value.
  • What kind of overviews do you miss in the Qt documentation?

    Unsolved
    20
    2 Votes
    20 Posts
    3k Views
    T
    Qt samples are not large enough. Include a few Qt-based open source applications and provide detailed step-by-step instructions.
  • Passing data structures from QML to C++

    Solved
    10
    0 Votes
    10 Posts
    3k Views
    JKSHJ
    (Further questions forked to https://forum.qt.io/topic/142227/update-c-list-model-from-qml )
  • Running ROS2 using QT5

    Solved
    9
    0 Votes
    9 Posts
    5k Views
    serkan_trS
    @JoeCFD yes I tried but the libraries I added are used for ROS1. so ROS2 also bases these jobs on ament_cmake so it gave errors. I solved the problem by cmake and moved forward Sample code for ROS2 [image: 34439394-6d19-4e1a-8fff-8ddcee3ce22a.png]
  • Ideas for modulize my code using qt for another qt project.

    Unsolved
    2
    0 Votes
    2 Posts
    573 Views
    jsulmJ
    @fromis_9 said in Ideas for modulize my code using qt for another qt project.: so this doesn't seem appropriate Why? If the other project is also based on Qt there is no problem to use a shared library which depends on Qt.
  • need ideas on styling a ListView

    Solved
    27
    0 Votes
    27 Posts
    8k Views
    mzimmersM
    For anyone who might be reading this for an answer to their own question, I looked at @TomZ 's solution, and realized that I had a bug in my delegate - my text centering wasn't taking the rounded corners effectively adding height to the top and bottom rows. I had to alter my delegate: Component { id: activityDelegate Rectangle { height: { var h = rect1.rowHeight; if (index === 0 || index === (activityModel.count - 1)) h -= rect1.radius return h; } width: rect1.width color: rect1.color Text { text: model.parameter anchors { left: parent.left leftMargin: parent.height / 2 verticalCenter: parent.verticalCenter verticalCenterOffset: { var o = 0; if (index === 0) o -= (radius / 2) else if (index === (activityModel.count - 1)) o += (radius / 2) return o; } } font.pixelSize: 14 font.bold: true } Styledswitch { id: onOff visible: model.switchVisible anchors { right: parent.right rightMargin: parent.height / 2 verticalCenter: parent.verticalCenter } } } } As always, if this doesn't look right, please let me know, and I'll fix it.
  • need ideas: how do YOU handle support for multiple resolution

    Solved
    3
    0 Votes
    3 Posts
    661 Views
    mzimmersM
    @TomZ yeah, I think I won't have to accommodate huge resolution differences, maybe from 800x480 to 1280x800 or so. I've already taken the approach of using separate files for classes. Not sure the Flow layouts will work, but I'll look into it. Thanks for the suggestions...
  • need a slick way of "hiding" my FontLoaders

    Solved
    11
    0 Votes
    11 Posts
    2k Views
    mzimmersM
    @JoeCFD I found the problem - I needed this line in my main.cpp: qmlRegisterSingletonType( QUrl( "qrc:/assets/Style.qml" ), "styles.stylesheet", 1, 0, "Style" ); Not sure how the SO example worked without this, but...it seems to be working for me now. Thanks for all the assistance on this.
  • How can I make a mock DB to be pulled into Alteryx?

    Unsolved xml db2 oracle
    2
    0 Votes
    2 Posts
    817 Views
    JonBJ
    @pavanforza Hello and welcome. Qt supports SQLite as a database, which is very simple to set up and use (file based). You can still send it SQL queries/statements to execute through the same Qt QSql...classes as would be used against an Oracle database.
  • Missing QT software access

    Moved Unsolved
    1
    1 Votes
    1 Posts
    416 Views
    No one has replied
  • QML: TabBar and StackLayout

    Solved
    9
    0 Votes
    9 Posts
    3k Views
    mzimmersM
    OK, I got it figured out. As @JoeCFD suggested, I needed anchors instead of Layout.*. Someday, I'll commit this to memory -- @fcarney will probably only have to remind me another 100 times... Thanks for the help.
  • getting QML to report on font used

    Solved
    4
    0 Votes
    4 Posts
    1k Views
    mzimmersM
    Since @JKSH answered my original question, I'm marking this as solved. I'll bring up my other questions in a new topic with a more accurate title.
  • lazily relocated series of X11 windows

    Solved
    2
    0 Votes
    2 Posts
    617 Views
    Kent-DorfmanK
    so no group feedback on this question but I did manage to locate (by accident) a utility that accomplishes the task. xdotool windowmove {windowid} {x} {y} uses XTEST extension which insers emulated mouse and keyboard events to the X server.
  • Porting a GUI from Qt 2(?)

    Unsolved
    6
    0 Votes
    6 Posts
    1k Views
    SGaistS
    Yes, that would the the correct sub-forum.
  • Trying to build Qt 4.12.4 from source

    Unsolved
    3
    0 Votes
    3 Posts
    762 Views
    Chris KawaC
    You've got Qt in the title and qt-creator in the command. Qt 4.12.4 in the title and /qt6-build in the command What are you actually trying to build? Qt or Qt Creator? Which version and if creator then against which Qt? On what platform?
  • Cyber Security Applications on QT !?

    Unsolved cybersecurity qt for python c++ qt security qtwebengine
    3
    0 Votes
    3 Posts
    1k Views
    SGaistS
    Hi and welcome to devnet, That's a bit too vast of a topic to have a simpler answer. What element of Cyber Security do you have in mind ? At what level ? Cyber Security starts from giving people access to certain hardware / applications to the boot process of your machines/devices, the kernel/OS they are running, the applications you are using on them, the libraries that composes these applications, the devices you plug in the machines, etc.
  • QT Run the project,error:“....”-f Makefile.Debug.

    Solved
    2
    0 Votes
    2 Posts
    782 Views
    jsulmJ
    @NutKey Please post in correct forum. Please translate Chinese to English, so people not speaking Chinese can actually understand the messages you posted.
  • Pausing a QThread

    Unsolved
    11
    0 Votes
    11 Posts
    3k Views
    Kent-DorfmanK
    The broader argument is that pausing a thread is a misuse of them. Also, you need to consider that the qt thread abstraction may not be a true system level thread, but instead a pseudo-thread that supports the common threading api and behaviour (to some extent). As for pause/yield/etc as in coroutines...seems like it's a 20 year full circle back to the era of cooperative multi-tasking, when the favored model has clearly become preemptive MT. Seems to me that the hint about how qt threads exist would be whether std::this_thread::sleep_for() works as expected, or does it introduce side-effects?
  • How to build qt shared library ?

    Unsolved
    2
    0 Votes
    2 Posts
    634 Views
    SGaistS
    Hi and welcome to devnet, Any chances that you are working on Windows ? In any case, you should read this page of the documentation.
  • Distribution of Qt via `conda-forge`

    Unsolved
    2
    0 Votes
    2 Posts
    2k Views
    JKSHJ
    @phreed said in Distribution of Qt via `conda-forge`: What I am looking for is advice on legally distributing Qt. If you plan to use Qt under the (L)GPL license, then you just need to comply with the rules of the (L)GPL license. The git repo git://code.qt.io/qt/qt5.git only goes back to v5.3 The old branches are gone, but the tags are definitely still there. https://code.qt.io/cgit/qt/qt5.git/tree/?h=v5.2.1