Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.1k Topics 454.7k Posts
QtWS25 Last Chance
  • 0 Votes
    2 Posts
    106 Views
    No one has replied
  • 0 Votes
    2 Posts
    147 Views
    jeremy_kJ
    See QAbstractItemModel - Subclassing. To add a row to an existing model, QAbstractItemModel::beginInsertRows() and endInsertRows() must be called. dataChanged() is used to announce changes to existing cells.
  • Add new tab to TabWidget when using Fusion style strange bahavior

    Unsolved
    15
    0 Votes
    15 Posts
    514 Views
    V
    UPDATE: Problem identified and resolved, kind of. After thinking about the difference between tabs created in the Designer and during application run time, the only thing I could think of was what the application style was set to at those 2 different times. The Designer related items are created in the constructor of the window, in the call to setupUI, and I was setting the app style to fusion after the window was getting instantiated, so the initial designer created tabs get created when the app style was set to the default, window11 in my case, but when tab were being added dynamically during the program runtime the app style had been changed to fusion. When I moved the setting of app style to before the window gets created everything works without issue. This does however raze another question/concern though. If I give the user of my application the ability to change app styles on the fly without requiring a program restart this same behavior would resurface along with potentially other unknown similar behaviors. I confirmed this to be the case in a small test app. I will search the documentation and news groups for any info related to changing styles at runtime to see how to properly do that. I would think that when a new app style is assigned it would trigger some sort of event that would cause all the application's widgets to get refreshed to implement the new style but I guess that is not %100 the case, at least not when it is done using the statement. "qApp->setStyle(QStyleFactory::create("fusion"));" Thanks again for all the support.
  • Calling a function inside of a *.qs file

    Unsolved
    1
    0 Votes
    1 Posts
    86 Views
    No one has replied
  • TCP connection with changing IP addresses

    Unsolved qtcpsocket network ip address
    13
    0 Votes
    13 Posts
    906 Views
    artwawA
    @jeremy_k said in TCP connection with changing IP addresses: You guys are seriously pessimistic about the state of end-to-end connectivity! I am sysadmin with over 20y of experience. "I've seen things you people wouldn't believe", to quote a classic. Serious note aside - the fact that something is possible doesn't mean one should try it. There's lots of "it depends on the use case" but I've had large enough share of commercial products with design compromising network security. That "pessimism" is perfectly warranted. More to the topic - I personally think the OP's design is abysmal in terms of security. Can they make it work? But of course. Would I allow such a solution in the network I manage? Under no circumstances. My advice here would be for the clients to report to the server's API at certain intervals, doing push-pull (so server would need a queue). Let's leave p2p connections for the LAN games. Other than that I think one can make it using UPNP, where target IP is safely obtained from the server's API together with a shortlived key used to validate incoming connection on the other end, but that's borderline already.
  • how to emit signal inside constructor

    Solved
    2
    0 Votes
    2 Posts
    410 Views
    JonBJ
    @DungeonLords As https://stackoverflow.com/questions/41220300/why-emit-signal-in-constructor-doesnt-work says, you won't have connected the signal while still inside the constructor so how should that work? You can use your "timer delay" to work around it if you want. Won't be emitted till next time event loop is hit. I have class that try to find files and analyse its. Maybe that's too much work to put in a constructor? You could avoid problems and timer if you move the finding/analyzing out of constructor and into some callable method?
  • Qt Linguist: recover text to the base language

    Solved
    9
    0 Votes
    9 Posts
    329 Views
    sitesvS
    @SimonSchroeder Thank You!
  • Set custom font on Windows 10 PC working but on Androird 10 not. Qt 6.4.2 C++

    Solved
    4
    0 Votes
    4 Posts
    191 Views
    sierdzioS
    No problem at all, this kind of thing happens to all of us :-)
  • QComboBox higlighted works differently between Qt C++ and PySide6

    Unsolved
    10
    0 Votes
    10 Posts
    309 Views
    JonBJ
    @lukutis222 said in QComboBox higlighted works differently between Qt C++ and PySide6: It does seem like the item is being higlighted (changes color to blue) when the ComboBox is expanded but no signal is triggered That does not sound right. And is not what I see with PySide2/Qt5. You did not check the selectedIndex() and its relation to the initial signal under both PySide & C++? Anyway, at this point I do not have PySide6 and it seems to work fine under PySide2. Verify your PySide6 is using the exact same version of Qt6 as you are using for your C++. Wait and see if someone else who has PySide6 tries/comments. Otherwise as I said produce an absolute minimal, identical PySide6 & Qt6/C++ test program and submit to Qt bug reports. (BTW: If you have/want to test PyQt6 to compare against PySide6 behaviour that can be revealing.)
  • failed decryption issue when not including encryption

    Solved
    2
    0 Votes
    2 Posts
    145 Views
    C
    What does this have to do with Qt? This is unlikely to be reliable as a writeable location: QString encryptedFile = QCoreApplication::applicationDirPath() + "/data0.dat"; What happens to bytes beyond the string here when (as in this example) the str is shorter than an encryption block? SecByteBlock block(size); memcpy(block, str.data(), std::min(size, str.size()));
  • Adding points to a QLineSeries - nothing displayed on chart

    qchart qlineser
    4
    0 Votes
    4 Posts
    3k Views
    JonBJ
    @mamsds This thread is a decade old. That OP seems to be claiming that instead of m_temperatureLineSeries = new QLineSeries(); you need m_temperatureLineSeries = new QLineSeries(m_temperatureChart );. However I do not believe that is true/will make any difference: m_temperatureChart->addSeries(m_temperatureLineSeries); line does that anyway. I suggest you open your own thread if you have a problem. You will need a minimal, standalone example program which illustrates the issue.
  • How does Qt synthesize Mouse Events from Touch Events?

    Unsolved
    13
    0 Votes
    13 Posts
    4k Views
    A
    @malikjahanzeb Do you know whether the touch events even arrive, and the issue lies in synthesizing the mouse events? I had an issue with a Touch PC where sometimes (in a kind of standby mode), no events whatsoever would arrive at my application for >5 s. What version of Qt are you using?
  • how to solve the error "Unsupported configuration"

    Unsolved
    3
    0 Votes
    3 Posts
    210 Views
    B
    @ChrisW67 said in how to solve the error "Unsupported configuration": Since that use has nothing to do with the compiler you are using to build your project it I would be a reasonable bet that the code actually compiles (with either GCC or MSVC). yes the code can still run, but will it break the encryption or decryption process?
  • How to update a model so it refreshes all its views?

    Unsolved model view prog
    2
    0 Votes
    2 Posts
    193 Views
    C
    Your class implementation of, for example, QAbstractItemModel::setData() should emit the dataChanged() signal. It is all fairly well described in subclassing.
  • re-running cmake with a different source

    Unsolved
    10
    0 Votes
    10 Posts
    4k Views
    kshegunovK
    @artwaw said in re-running cmake with a different source: @Pl45m4 another spam account posting on a long dead thread. I report at least three per day... @Pl45m4 said in re-running cmake with a different source: What's the point of posting random, unrelated sh!t? How do one know what "services" they are offering? xD What typically is the case, is we get backlink spam - at some point a benign looking post is edited to add links to some unrelated thing. If it is really obvious from the start, we delete the post directly, otherwise we may wait some time for the "spammy nature" of the post to manifest itself. In any case we try to give people a fair chance, if for example they'd missed the point of the discussion, posting in the wrong place or w/e.
  • 0 Votes
    3 Posts
    174 Views
    R
    No, I do plan to stick with Qt5, and may not need to go older than Qt 5.8 (the last to support OS X 10.9) and don't really want to go older than 5.6 . Looking at the 5.10 sources I'd have to derive QSlotObjectBase class (looks like that might work) but also provide a custom QFunctorSlotObject class, to be used via a QFunctorSlotObjectWithNoArgs template. That one has a static void impl() function, and the instance I'd create gets handed to the QMetaCallEvent ctor, meaning I'd probably have to derive that class too in hope that gets me deep enough? I wonder if I didn't already try to go down this rabbit hole once for Qt 5.9 . I'd forgotten, but invokeMethod support for "functors" is actually among the tidbits that I ended up backporting to my patched Qt 5.9 . This time I'm not planning to "just patch Qt already" ;) Googling for a lib[std]c++ mechanism to execute a function on a specific thread I found this answer: https://stackoverflow.com/a/21653558/1460868 , suggesting in particular this bit of code: void postToMainThread(std::function<void()> && fun) { QObject signalSource; QObject::connect(&signalSource, &QObject::destroyed, qApp, [fun(std::move(fun))](QObject*){ fun(); }); } It appears to do the trick (at the cost of some additional overhead due to the temp. object). There's also namespace detail { template <typename F> struct FEvent : public QEvent { using Fun = typename std::decay<F>::type; Fun fun; FEvent(Fun && fun) : QEvent(QEvent::None), fun(std::move(fun)) {} FEvent(const Fun & fun) : QEvent(QEvent::None), fun(fun) {} ~FEvent() { fun(); } }; } template <typename F> static void postToObject(F && fun, QObject * obj = qApp) { QCoreApplication::postEvent(obj, new detail::FEvent<F>(std::forward<F>(fun))); } In both cases I'd need to verify if they do synchronous execution and, if not, figure out how to make them that. EDIT: note to self: the 1st solution requires C++14, the second is C++11 compatible.
  • Regarding the example given by qInstallMessageHandler in the official documentation

    Solved
    4
    0 Votes
    4 Posts
    220 Views
    M
    [image: dddbd9f1-f629-420b-9515-fbf261f95f47.png] Oddly enough, I didn't include any interrupt program action in the case QtFatalMsg statement. But when debugging, the qFatal() line is still interrupted, even before it enters the event loop!
  • Custom QPushButton with exposed properties in qss Hover state issue.

    Unsolved
    5
    0 Votes
    5 Posts
    261 Views
    B
    Thank you for your assistance. I tried your proposal, but it didn't work. I even isolated the style for these buttons, but the result was the same. If anyone knows whether this issue is resolved in Qt 6.7, I would appreciate your input.
  • My widget doesn't auto resize

    Unsolved
    2
    0 Votes
    2 Posts
    93 Views
    Pl45m4P
    @Xav12358 said in My widget doesn't auto resize: What parameters in the ui should I use to activate the autoresize functionality? Pick a proper layout (layout strategy). A GridLayout inside a GridLayout is not what you want there. It might influence the resize behavior as you are experiencing right now. Edit: Are you sure that you have compiled your current version of UI file? I see buttons in your widget, but the UI template doesn't show any.
  • Crash related to network activity in p2p app on macOS M1

    Unsolved
    2
    0 Votes
    2 Posts
    192 Views
    J
    Hi, we experience several crashes that sometimes look alike (see first stack-trace in my ticket: https://forum.qt.io/topic/158065/crashes-on-macos-arm-using-sockets) To me it looks as if there's a remaining reference not properly cleaned up after a deletion of a QObject. Regards