Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.6k Posts
  • The problem of crash of function pointer passed in function

    Unsolved
    3
    0 Votes
    3 Posts
    293 Views
    Chris KawaC
    @QtCaiJi It's hard to tell what's wrong because you seemingly removed lines of actual code at random. this1 is never assigned in that snippet. dll_CreatePlayer is not used. Type LONG is a signed 32bit integer, so reinterpreting a function pointer to it sounds horrible and will not do what you think on e.g. 64bit system. As to the problem at hand - if it crashes then run it under a debugger and see the callstack. We can't help if we don't know what the problem is. I cannot successfully load other dlls that this dll depends on [..], why is this? When you run by starting the exe directly the working directory for your app is that exe's location. When running from Qt Creator it's usually one directory up from where the exe is located (unless you change it in the project run settings). Depending on where your dll and its dependents are located they simply might not be in a location Windows looks for them. This exposes a problem in your application that it depends on a working directory path to load its dependents. It shouldn't do that as you can't predict how the end user will start your app (a shortcut, command line etc.) and so you can't predict what the working directory will be. You should structure your app so that dependencies are automatically picked up according to standard lookup rules or, if you load them manually, are using paths relative to your executable, not working directory.
  • Correct way to synchronize QOpenGLWidget repaint from a worker thread

    Unsolved
    12
    0 Votes
    12 Posts
    1k Views
    febiodeveloperF
    @Christian-Ehrlicher Thanks for looking into this. I will post a bug report.
  • Best way to show a html page after a click on a table cell

    Solved
    4
    0 Votes
    4 Posts
    339 Views
    A
    @Pl45m4 Thank you. I'll try that.
  • How to build poppler in windows and include poppler to QT Creator?

    Unsolved
    2
    0 Votes
    2 Posts
    1k Views
    Christian EhrlicherC
    @King-DEV You have to compile and install poppler first. You can not use the sources directly. There may be per compiled windows builds out there.
  • Application developed using QT can't show window

    Unsolved
    4
    0 Votes
    4 Posts
    448 Views
    R
    Thank you for the replies. Here's the basic information about my laptop. I have connected to two displays, one is internal and the other is external. I have found that the issue will only happen when the external display is attached, but if I detach the external display, the issue still may not resolve. I also attached a log from Paraview, which may help identify the issue. Paraview Debug Output System Summary OS Name Microsoft Windows 11 Pro Version 10.0.22631 Build 22631 Other OS Description Not Available OS Manufacturer Microsoft Corporation System Manufacturer LENOVO System Model 82TD System Type x64-based PC System SKU LENOVO_MT_82TD_BU_idea_FM_Legion 7 16IAX7 Processor 12th Gen Intel(R) Core(TM) i9-12900HX, 2300 Mhz, 16 Core(s), 24 Logical Processor(s) BIOS Version/Date LENOVO K1CN44WW, 8/17/2023 SMBIOS Version 3.4 Embedded Controller Version 1.36 BIOS Mode UEFI BaseBoard Manufacturer LENOVO Platform Role Mobile Secure Boot State On PCR7 Configuration Elevation Required to View Windows Directory C:\Windows System Directory C:\Windows\system32 Boot Device \Device\HarddiskVolume2 Locale United States Hardware Abstraction Layer Version = "10.0.22621.2506" Time Zone Pacific Standard Time Installed Physical Memory (RAM) 64.0 GB Total Physical Memory 63.7 GB Available Physical Memory 30.9 GB Total Virtual Memory 67.7 GB Available Virtual Memory 24.5 GB Page File Space 4.00 GB Page File C:\pagefile.sys Kernel DMA Protection On Virtualization-based security Running Virtualization-based security Required Security Properties Virtualization-based security Available Security Properties Base Virtualization Support, Secure Boot, DMA Protection, UEFI Code Readonly, SMM Security Mitigations 1.0, Mode Based Execution Control, APIC Virtualization Virtualization-based security Services Configured Virtualization-based security Services Running Windows Defender Application Control policy Enforced Windows Defender Application Control user mode policy Off Device Encryption Support Elevation Required to View A hypervisor has been detected. Features required for Hyper-V will not be displayed. Display Summary Name NVIDIA GeForce RTX 3080 Ti Laptop GPU PNP Device ID PCI\VEN_10DE&DEV_2460&SUBSYS_3F9517AA&REV_A1\4&1B34B0B3&0&0008 Adapter Type NVIDIA GeForce RTX 3080 Ti Laptop GPU, NVIDIA compatible Adapter Description NVIDIA GeForce RTX 3080 Ti Laptop GPU Adapter RAM (1,048,576) bytes Installed Drivers C:\Windows\System32\DriverStore\FileRepository\nvltsi.inf_amd64_0adc7c076738dad1\nvldumdx.dll,C:\Windows\System32\DriverStore\FileRepository\nvltsi.inf_amd64_0adc7c076738dad1\nvldumdx.dll,C:\Windows\System32\DriverStore\FileRepository\nvltsi.inf_amd64_0adc7c076738dad1\nvldumdx.dll,C:\Windows\System32\DriverStore\FileRepository\nvltsi.inf_amd64_0adc7c076738dad1\nvldumdx.dll Driver Version 31.0.15.4633 INF File oem150.inf (Section247 section) Color Planes Not Available Color Table Entries 4294967296 Resolution 3840 x 2160 x 60 hertz Bits/Pixel 32 Memory Address 0x83000000-0x840FFFFF Memory Address 0x0000-0x1FFFFFF IRQ Channel IRQ 4294967214 Driver C:\WINDOWS\SYSTEM32\DRIVERSTORE\FILEREPOSITORY\NVLTSI.INF_AMD64_0ADC7C076738DAD1\NVLDDMKM.SYS (31.0.15.4633, 56.02 MB (58,741,280 bytes), 12/15/2023 5:41 PM) Name Intel(R) UHD Graphics PNP Device ID PCI\VEN_8086&DEV_4688&SUBSYS_3B1717AA&REV_0C\3&11583659&0&10 Adapter Type Intel(R) UHD Graphics Family, Intel Corporation compatible Adapter Description Intel(R) UHD Graphics Adapter RAM 1.00 GB (1,073,741,824 bytes) Installed Drivers <>,C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_8db4fc1f9863e4f6\igd10iumd64.dll,C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_8db4fc1f9863e4f6\igd10iumd64.dll,C:\Windows\System32\DriverStore\FileRepository\iigd_dch.inf_amd64_8db4fc1f9863e4f6\igd12umd64.dll Driver Version 31.0.101.3222 INF File oem18.inf (iADLSD_w10_DS section) Color Planes Not Available Color Table Entries 4294967296 Resolution 2560 x 1600 x 165 hertz Bits/Pixel 32 Memory Address 0x2000000-0x2FFFFFF Memory Address 0x0000-0xFFFFFFF I/O Port 0x00005000-0x0000503F IRQ Channel IRQ 4294967232 Driver C:\WINDOWS\SYSTEM32\DRIVERSTORE\FILEREPOSITORY\IIGD_DCH.INF_AMD64_8DB4FC1F9863E4F6\IGDKMDN64.SYS (31.0.101.3222, 42.68 MB (44,750,816 bytes), 9/21/2022 9:01 PM)
  • comments on QProgress bar example

    Unsolved
    2
    0 Votes
    2 Posts
    281 Views
    Pl45m4P
    @AnneRanch said in comments on QProgress bar example: I though that comments like these , in professional example , are about kindergarten grade. Maybe you mention what exactly you dont understand?! The example is pretty simple, so what comments do you expect? They describe what is happening in the next line(s). as I find the comments not helping to analyze the code to find what exactly is the purpose of it . They do. And from looking at the code you can see/guess/assume what every single line does, even you if have never used Qt before... from the naming, the usage and these few comments, which you are claiming to be Kindergarten ;-) If you think there are more comments than code needed, in an example with the solely purpose of showing how QProgressBar in combination with some QtConcurrent elements works and how you could use it (besides reading the documentation), go ahead. Provide some "more useful" comments and contribute... The comments are actually even better than I would have expected and more than needed. Like here ¯\_(ツ)_/¯ // Create a progress dialog. QProgressDialog dialog; or here // Display the dialog and start the event loop. dialog.exec(); and here (comment on qDebug output) // Query the future to check if was canceled. qDebug() << "Canceled?" << futureWatcher.future().isCanceled(); If you ditch those and there would be no comments at all, this post would look like "Why are there no comments on this example?". People are always complaining...
  • This topic is deleted!

    Unsolved
    3
    0 Votes
    3 Posts
    36 Views
  • connect with/without lambda - why not equivalent?

    Solved
    5
    0 Votes
    5 Posts
    429 Views
    J
    The problem in my code was a hidden disconnect statement. To close this thread properly, let me summarize what I understood from the docs: The two forms are perfectly equivalent as long as sender and receiver are alive. They differ in how they react to destruction of the receiver: A connection established through form 1 will automatically be deleted, which is not the case for form 2, hence the segfault when this->f is called though this no longer exists.
  • creating QOpenGLWidget performance issues

    Unsolved
    10
    0 Votes
    10 Posts
    1k Views
    Chris KawaC
    Merry christmas Thanks, same to you. Stopping GDB execution 5ish times always seems to land on the GL context creation. Oh, that's absolutely the wrong way to do it. You might as well roll a dice. Use a profiler. That's what they're for. Since you're on Windows Visual Studio has a basic profiling tool that's more than enough for this kind of task. In the end what I did was refactor "some" of my QOpenGLWidgets to just be regular QWidgets I'm glad you found a solution that works for you. If you ever get into it again make sure to measure it properly. Debugging GPU related performance issues is tricky. Intuition goes out the window pretty quickly and reliable numbers are the best way to deal with it.
  • Main Thread Is Blocked By Mouse Wheel When I Involved other ui process for QT 5.14.2

    Unsolved
    4
    0 Votes
    4 Posts
    306 Views
    Axel SpoerlA
    @even0421 I can’t reproduce that with Qt 6.5 on openSuSE Linux. I haven’t tried on 5.14 and I won’t do that. Suggest you upgrade to a supported Qt version and try again.
  • How can I know when a widget and layout has their final geometries?

    Unsolved
    12
    0 Votes
    12 Posts
    2k Views
    l3u_L
    @JonB Yeah, a gerneral solution for such problems would be fine … bit it looks like it's not trivial …
  • This topic is deleted!

    Unsolved
    8
    0 Votes
    8 Posts
    409 Views
  • Determine media file format based on codec

    Solved multimedia codec file format
    4
    0 Votes
    4 Posts
    1k Views
    C
    @Saviz The example does not come copy-n-paste from the docs, it comes from reading the docs. This will list all the combinations that are possible on the running platform concerned: #include <QCoreApplication> #include <QDebug> #include <QMediaFormat> int main(int argc, char **argv) { QCoreApplication app(argc, argv); const QList<QMediaFormat::FileFormat> containers = { QMediaFormat::WMA, QMediaFormat::AAC, QMediaFormat::Matroska, QMediaFormat::WMV, QMediaFormat::MP3, QMediaFormat::Wave, QMediaFormat::Ogg, QMediaFormat::MPEG4, QMediaFormat::AVI, QMediaFormat::QuickTime, QMediaFormat::WebM, QMediaFormat::Mpeg4Audio, QMediaFormat::FLAC }; const QList<QMediaFormat::AudioCodec> audioCodecs = { QMediaFormat::AudioCodec::WMA, QMediaFormat::AudioCodec::AC3, QMediaFormat::AudioCodec::AAC, QMediaFormat::AudioCodec::ALAC, QMediaFormat::AudioCodec::DolbyTrueHD, QMediaFormat::AudioCodec::EAC3, QMediaFormat::AudioCodec::MP3, QMediaFormat::AudioCodec::Wave, QMediaFormat::AudioCodec::Vorbis, QMediaFormat::AudioCodec::FLAC, QMediaFormat::AudioCodec::Opus, QMediaFormat::AudioCodec::Unspecified }; const QList<QMediaFormat::VideoCodec> videoCodecs = { QMediaFormat::VideoCodec::VP8, QMediaFormat::VideoCodec::MPEG2, QMediaFormat::VideoCodec::MPEG1, QMediaFormat::VideoCodec::WMV, QMediaFormat::VideoCodec::H265, QMediaFormat::VideoCodec::H264, QMediaFormat::VideoCodec::MPEG4, QMediaFormat::VideoCodec::AV1, QMediaFormat::VideoCodec::MotionJPEG, QMediaFormat::VideoCodec::VP9, QMediaFormat::VideoCodec::Theora, QMediaFormat::VideoCodec::Unspecified }; for (const auto &c : containers) { QMediaFormat format(c); for (const auto &v : videoCodecs) { format.setVideoCodec(v); for (const auto &a : audioCodecs) { format.setAudioCodec(a); if (format.isSupported(QMediaFormat::Encode)) { qDebug() << QMediaFormat::fileFormatName(c) << "(" << QMediaFormat::videoCodecName(v) << ", " << QMediaFormat::audioCodecName(a) << ")"; } } } } return 0; } If you only want to support "closely aligned" combinations then only check those. There's no direct connection between the container format and the name of the file it is contained in. This is done purely by convention. If you want to put an MPEG4 container with audio-only in a file called blah.acc then go right ahead. Most players, I assume, only use this as a hint as to the file content and actually read the content to determine what is sane to do.
  • Is there a cmake variable like QT_TRANSLATIONS_DIR which holds the real path?

    Unsolved
    2
    0 Votes
    2 Posts
    217 Views
    Christian EhrlicherC
    You can install your translation in whatever location you want.
  • QTableView with QAbstractTableModel derrived class not displaying data

    Solved qtableview
    3
    0 Votes
    3 Posts
    610 Views
    C
    @Christian-Ehrlicher said in QTableView with QAbstractTableModel derrived class not displaying data: Elements I don't see where you fill this container. Sorry, I should have mentioned that Elements is being filled, and has been tested. I was originally using a QListView with QStringListModel which worked to show that Elements was being filled. When I switched to QTableView and QAbstractTableModel I had added a debug statement to rowCount() to also confirm that Elements was filled. void RailDocModel::operator<<( LayoutObject * NewElement ) { Elements << NewElement; } And here you're missing some important signals: https://doc.qt.io/qt-6/model-view-programming.html#inserting-and-removing-rows That pointed me to what I was missing. Changing operator<<() to this was the solution: void RailDocModel::operator<<( LayoutObject * NewElement ) { beginInsertRows( QModelIndex(), Elements.count(), Elements.count() ); Elements << NewElement; endInsertRows(); } I had tried adding beginInsertRows() and endInsertRows() recently, but had used nullptr as the first parameter to beginInsertRows() instead of QModelIndex().
  • Track Cursor Events With Window Click Through

    Unsolved
    10
    0 Votes
    10 Posts
    1k Views
    Axel SpoerlA
    @HOSHI The architecture seems off and overly complicated to me: You implement a class inheriting from QWidget, which looks like an application's main window. This class' mouse events are intercepted to eventually move a highlighter with the cursor. We don't know anything about this highlighter, so I assume it's just a normal cursor, surrounded by a halo. => Why don't you write your own cursor(s), inheriting from QCursor and use setOverrideCursor()?
  • load plugin Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so

    Unsolved
    3
    0 Votes
    3 Posts
    849 Views
    aha_1980A
    @JonB @grafenocarbono For me it was: sudo apt install libxcb-cursor0 (with trailing zero) The -dev is not needed for running Creator.
  • 0 Votes
    4 Posts
    375 Views
    Chris KawaC
    @Sauntor Or, like the documentation I linked suggests, merge all translations into one file using lconvert.
  • What event is Command+W in Qt

    Solved
    2
    0 Votes
    2 Posts
    200 Views
    M
    @CompSciDude said in What event is Command+W in Qt: Does anyone know if Command+W triggers a specific type of event The event is of type QEvent::ShortcutOverride:
  • Qt::SingleShotConnection only

    Solved
    2
    0 Votes
    2 Posts
    778 Views
    Christian EhrlicherC
    @DungeonLords said in Qt::SingleShotConnection only: Does this codes equals? Simply try it out - both are the same because Qt::AutoConnection is 0 as you can see in the documentation.