Skip to content

Brainstorm

Stuck? Some ideas just need to be dumped on someone before they can materialize.
452 Topics 3.2k Posts
  • controls that don't really "control"

    Solved
    5
    0 Votes
    5 Posts
    745 Views
    mzimmersM
    @TomZ said in controls that don't really "control": My personal advice on the usecase where getting a new state may take more than 200ms is to have your datamodel update the state after 250ms to "waiting-for-state-B" or something (use a timer) and then the front-end can show the 3rd state, indicating that its busy doing what you requested. I agree completely -- it's just a little hard to figure out how to do this with a Switch. EDIT: I got my issue with the Switch figured out - it wasn't so much a state problem as it was my lousy model implementation (explained in painful detail elsewhere in the forum). Thanks to all for the help.
  • Insight Web Console in WebAssembly

    Unsolved
    2
    0 Votes
    2 Posts
    324 Views
    lorn.potterL
    It probably could be built using Qt WebAssembly, as it looks to be javascript based.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • kmap2qmap

    Unsolved
    12
    0 Votes
    12 Posts
    1k Views
    SGaistS
    @myneur The us.kmap from that link is valid. However, it does also generate around 40 warnings as the other two do. Do you still need the qmap files ?
  • Some advice for a table application

    Unsolved
    4
    0 Votes
    4 Posts
    593 Views
    M
    @Hannibal said in Some advice for a table application: What about the first and last columns, should I merge the cell for have the same look as pics? https://forum.qt.io/topic/123343/qtableview-qtablewidget-cell-span-range Search the web and this forum, there's numerus topics on this.
  • displaying only part of model

    Solved
    6
    0 Votes
    6 Posts
    750 Views
    mzimmersM
    @SGaist maybe it's because I'm old school, or maybe it's because I have enough trouble reading other people's code, but...whatever the reason, I prefer to explicitly derive a function's return value, assign it to a variable, and return that variable. I realize it accomplishes nothing, and in the absence of a good optimizing compiler, is actually fractionally slower, but...it's just how I roll.
  • identifying signal senders

    Solved
    17
    0 Votes
    17 Posts
    3k Views
    mzimmersM
    @TomZ I ended up taking Jeremy's suggestion, and it works beautifully. Keeps the message manager self contained and no need for state awareness.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    3 Views
    No one has replied
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    11 Views
    No one has replied
  • Which QT framework for dashboard of ship

    Unsolved
    4
    0 Votes
    4 Posts
    733 Views
    SGaistS
    That's good to know. In that case, depending on the fanciness you want, Qt Quick is still a good option as it allows for more visual effects and they would be easier to implement than with widgets. Otherwise the graphics view framework will also be of interest. On what kind of device will your dashboard run ? KDAB has built something for boats.
  • Implementing many-to-many relationships

    Solved
    40
    0 Votes
    40 Posts
    11k Views
    TomZT
    @mzimmers said in Implementing many-to-many relationships: Doesn't seem to me that I'd need new/delete anyway, but I do agree that it seems preferable to: create and maintain a map of Equipment objects (or structs) with a UUID as the key in the Activity object, maintain a list of Equipment UUIDs. Is this what you had in mind? The various comments here went towards using pointers to instances of classes as the relationship. Can't use a raw pointer (safely) without 'new'. If your only objects are the Equipment and the Activity, then yeah, that's pretty simple. as this got confusing, here is a very quick and dirty mockup I just wrote in 5 minutes. Apologies for the roughness. struct PActivity; struct PEquipment; class ManagerPrivate { public: std::map<int, PActivity> m_activities; std::map<int, PEquipment> m_equipments; int m_lastAssignedId = 0; }; struct PActivity { QString name; }; struct PEquipment { QString name; std::deque<int> activities; }: class Manager { public: ManagerPrivate *d; Activity createActivity(); }; // ---- class Activity { public: explicit Activity(Manager *parent, int n); Activity(); // gives invalid instance. bool isValid() const { return d && n; } QString name() const { assert(isValid()); auto i = d->m_activities.find(n); assert(i != d->m_activities.end()); return i->name; } void setName(const QString &name) { assert(isValid()); auto i = d->m_activities.find(n); assert(i != d->m_activities.end()); i->name = name; } int id() const { return n; } private: ManagerPrivate *d = nullptr; int n = 0; }; class Equipment { explicit explicit(Manager *parent, int n); explicit(); // gives invalid instance. bool isValid() const; QString name() const; void setName(const QString &name); void addActivity(const Activity &a) { assert(a.isValid()); assert(isValid()); auto i = d->m_equipments.find(n); assert(i != d->m_equipments.end()); i->activities.push_back(a->id()); } private: ManagerPrivate *d = nullptr; int n = 0; }
  • 0 Votes
    2 Posts
    306 Views
    Kent-DorfmanK
    in my 30+ years of experience taking over someone elses app usually means throwing it out the nearest airlock and doing it from scratch "correctly". The previous owner never knew what the tar they were doing. LOL
  • need suggestions for transition/animation of banner

    Solved
    7
    0 Votes
    7 Posts
    692 Views
    mzimmersM
    @sierdzio yes, that seemed to fix it. Item { id: banner property int bannerHeight: 80 implicitHeight: (opMode.mode === OpModes.Service) || (navBar.tabIndex === 3) ? bannerHeight : 0 Behavior on implicitHeight { NumberAnimation { duration: 250 } } Layout.fillWidth: true Rectangle { id: rect anchors { left: parent.left right: parent.right } implicitHeight: parent.implicitHeight ... } } I think I need to apply a similar animation to the opacity of the contents of the Rectangle (a couple lines of text and a Button), but I get the principle now. Thanks to all for the help.
  • Update C++ list model from QML

    Solved
    11
    0 Votes
    11 Posts
    2k 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
    2k Views
    T
    Qt samples are not large enough. Include a few Qt-based open source applications and provide detailed step-by-step instructions.
  • Register a Qt account twice

    Unsolved
    2
    0 Votes
    2 Posts
    470 Views
    SGaistS
    Hi, You should open a ticket about that matter in your Qt account page. This is a user forum and there you need the Qt Company admins help.
  • Passing data structures from QML to C++

    Solved
    10
    0 Votes
    10 Posts
    2k 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
    4k 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
    358 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
    5k 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.