Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.8k Posts
  • QIcon Recoloring: Best Approach?

    Unsolved
    3
    0 Votes
    3 Posts
    1k Views
    E
    Depending on the style, icons will be set on buttons (QDialogButtonBox, QMessageBox::StandardButtons, etc.). These icons are never guaranteed to match the "theme" that you have in place, and I'm wondering if there's a virtual method somewhere that would allow me to process the QIcon and return the processed. I've already come up with functionality to resize & reshape an icon, but I appreciate the suggestion. My methodology takes code from a private class used by QGraphicsColorizeEffect called QPixmapColorizeFilter. I simply make a new pixmap from the icon at a certain size & run it through the recolor function, and as long as the accompanying QPainter works as it should then my pixmap will be replaced with the colorized one. Usage looks like this. QIcon function() { QPixmap px = QIcon(/* whatever icon */).pixmap(/* whatever size */); QPainter p(&px); recolor(&p, px, QColor(/* whatever color */), 1 /* whatever strength */); return QIcon(px); }
  • 0 Votes
    4 Posts
    315 Views
    M
    Try compiling it with the MSVC2017 version of Qt, not the WinRT (UWP) version of Qt. QProcess, for example, can't be used with WinRT: https://doc.qt.io/qt-5/winrt-support.html#notes-to-desktop-users
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • Stacked Widget - changing background image on StyleSheet

    Solved
    6
    0 Votes
    6 Posts
    2k Views
    JonBJ
    @leo738 said in Stacked Widget - changing background image on StyleSheet: error: ‘indexOfPage2’ was not declared in this scope Well of course! You are supposed to understand code, not just copy it! That is where you replace by whatever the index is of your desired page --- 1? 2? I don't know. I really didn't expect to have to say that.... UPDATE I see you have posted with brain re-engaged and your second widget is indeed at index 1, so that's simplest :)
  • Qt Json only adds 1 new entry eachtime code is called

    Unsolved
    2
    0 Votes
    2 Posts
    264 Views
    Christian EhrlicherC
    You read a QJsonArray but store a QJsonObject - how is this suppose to work? As we already told you somewhere else you should check the type of your QJsonValue/QJsonDocument via https://doc.qt.io/qt-5/qjsondocument.html#isArray
  • 0 Votes
    8 Posts
    3k Views
    artwawA
    @jsulm That came to my mind too but considering that all the other parts of Ui work - push buttons, tool buttons, all the actions associated with tool buttons and menu, two table views with sql table models, status bar displays status tips on hover over elements... I had to ditch that idea.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • 0 Votes
    1 Posts
    101 Views
    No one has replied
  • How to trigger QQuickItem.update() when worker thread finishes?

    Solved
    3
    0 Votes
    3 Posts
    1k Views
    Tom assoT
    @jeremy_k wrote There's QQuickItem::update() and QQuickFramebufferObject::Renderer::update(). By any chance is the code calling the wrong one? Yes, that was exactly the problem; my renderer code called QQuickItem::update() . Instead it now calls QQuickFramebufferObject::Renderer::update(), and no more "Updates can only be scheduled from GUI thread" warning. Brilliant, thanks!
  • This topic is deleted!

    Solved
    5
    0 Votes
    5 Posts
    93 Views
  • QNetworkAccessManager doesn't send signals

    Unsolved
    9
    0 Votes
    9 Posts
    592 Views
    SGaistS
    Well, as already written, with the bits you posted we can't determine what is going wrong as the code looks correct. So if possible please provide a minimal compilable sample that shows your issue.
  • Project ERROR: Unknown module(s) in Qt:serialbus

    Unsolved
    2
    0 Votes
    2 Posts
    466 Views
    SGaistS
    Hi and welcome to devnet, How did you install Qt on your desktop ?
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • adding to json file without deleting the content

    Solved
    10
    0 Votes
    10 Posts
    997 Views
    JonBJ
    @Kris-Revi said in adding to json file without deleting the content: like what and how does that work? All I meant was you'd have to make your saved JSON like, say, { "New Device": { "IPA": "newdevice", ..., "Order": 1 }, "Studio Lights": { "IPA": "studiolights", ..., "Order": 0 } } So I made each element have an Order attribute, counting from 0 upward like an array for the order they were in when I saved. Which as shown above happens randomly to have come out not in that order when saved. Now it's your responsibility when reloading and recreating "populate my device list with buttons for each device" to look at the Order attribute on each one and use that to order your device list as you want it to be. The other way, if order is so important, is not to store as just an object with an arbitrary list of named attributes ( "New Device":, "Studio Lights": ...) as you have done here, precisely because you cannot order those. Instead store as an array/list like: { [ { "Name": "New Device", "IPA": "newdevice", ..., "Order": 1 }, { "Name": "Studio Lights", "IPA": "studiolights", ..., "Order": 0 } ] } This is an array/list of objects, so it does have an order which is preserved on save/restore. Of course, that then takes you back to your original code as to how to locate an object element by Name, but that's the price you pay if ordering is important to you.
  • QScrollArea/QScrollBar stylesheet

    Unsolved
    3
    0 Votes
    3 Posts
    484 Views
    D
    @JonB thanx, but it workn't for me. mb other stylesheets prevent setting
  • QPlainTextEdit removes carriage returns "\r"

    Unsolved
    4
    0 Votes
    4 Posts
    626 Views
    A
    @JonB Hi thanks for replies. I was parsing the text from Apache Tika , and so the \r was not removed. calling text.replace("\r\n", "\n"); before doing the search was a good workaround
  • How to move an object back to mainThread

    Unsolved
    4
    0 Votes
    4 Posts
    541 Views
    JKSHJ
    @themts said in How to move an object back to mainThread: that is clear. I'm inside the QtConcurrent function and at the end I want to PUSH it to the mainThread. OK, that sounds good. Can you elaborate on what you mean by "that doesn't work"? What happens? How can you tell that it didn't work?
  • Write a program to control application on Windows

    Unsolved
    8
    0 Votes
    8 Posts
    651 Views
    Pablo J. RoginaP
    @gold said in Write a program to control application on Windows: i found solution. Two things please: Could it be possible you share the solution you found? After sharing, don't forget to mark this post as solved! Thanks.
  • QGroupBox automatically sizing

    Unsolved
    5
    0 Votes
    5 Posts
    378 Views
    SPlattenS
    @raven-worx , I think I'll stick with my fiddle factor: static const quint16 scuint16CheckBoxIndicatorWidth = 24; intAlarmsWidth += scuint16CheckBoxIndicatorWidth;
  • Equivalent of DESTDIR in CMAKE

    Solved
    3
    0 Votes
    3 Posts
    846 Views
    L
    @artwaw Thanks for the link! I solved by putting set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../bin) under the set(PROJECT_SOURCES .....) in my CMakeLists.txt.