Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.6k Posts
  • How to extract the text of custom text object format in QTextEdit

    Solved
    6
    0 Votes
    6 Posts
    738 Views
    HansonH
    @Hanson Finally,I find a way to traverse QTextDocument in QTextEdit,and extract all data I want,include the normal text and my custom text object. [image: 31aab285-e80a-47c1-ae6e-3ae8b65a7c67.png]
  • What is the difference between layout default constraint and no constraint?

    Solved
    3
    1 Votes
    3 Posts
    562 Views
    Chris KawaC
    SetNoConstraint basically does nothing i.e. it does not change the widget's minimum or maximum sizes. If the widget had a min or max size it will keep it. If it didn't then it won't get any either. SetDefaultConstraint checks if the widget has explicitly set minimum size. If it does then it stays as was set. If it doesn't then widget gets minimum size set from the minimum size calculated by layout. In practice there's no visual difference. The widget won't get smaller than what the layout dictates whether it has minimum size set or not. If you manually set minimum size greater than that calculated by layout it will stay that way no matter which mode you choose - SetNoConstraint doesn't change it ever and SetDefaultConstraint won't change it because it was manually set. The difference is only when you don't explicitly set a minimum size. In that case SetDefaultConstraint sets it, while SetNoConstraint doesn't, so if you ask widget for its minimumSize() it will give you different results with those two modes.
  • Thumbnail image on mouse hover

    Unsolved
    1
    0 Votes
    1 Posts
    121 Views
    No one has replied
  • Font rendering issue (kerning)

    Unsolved
    3
    0 Votes
    3 Posts
    413 Views
    DuBuD
    @SimonSchroeder Thanks for your response. I didn't know the font itself contains information for the kerning. Since we use our own font, I went back to an older version and now the rendering looks fine again. I need to investigate what broke the font.
  • QPrinter "mediaType" setting?

    Unsolved
    1
    0 Votes
    1 Posts
    233 Views
    No one has replied
  • Bluetooth scan failure on service discovery start

    Unsolved
    2
    0 Votes
    2 Posts
    741 Views
    ocgltdO
    To help out others facing similar problems, here's what i have (tentatively) concluded: The device/service discovery process uses an external program called sdpcanner, which is launched using QProcess. If the sdpscanner encounters a device/service which does not respond as expected it times out/crashes. That results in the error shown. Qt discovery launces many sdpscanner procresses. If one succeeds it will respond with what it found. If none succeed, you get now discovered devices/services. (Not very reliable) If someone knowledgeable can add to / correct the above please jump in.
  • query a condition will lead to high cpu rate but msleep() will miss signal

    Solved
    5
    0 Votes
    5 Posts
    380 Views
    Q
    @JonB thanks ,I will try it later.
  • Thread / OpenCV Segmentation Fault

    Solved
    6
    0 Votes
    6 Posts
    1k Views
    L
    @JonB Thank you for your reply. self.deleteLater() terminates the whole thread and must stay in the quit() method. But moving self.capture.release() into run() method was the solution!
  • QComboBox popup disappears.

    Solved
    5
    0 Votes
    5 Posts
    538 Views
    G
    I did an ugly hack by subclassing QComboBox. Set the QComboBox editable, no insert, and the line edit as readonly.
  • Problem with inheritance and QObject/QDialog

    Unsolved
    6
    0 Votes
    6 Posts
    636 Views
    S
    @Perdrix said in Problem with inheritance and QObject/QDialog: A very short example of what you have in mind would be most helpful I assume that this is in response to callback functions. Basically, you would have two functions: one for registering a callback with its associated data and the other to call the callback. For simplicity I'll assume there will only be one single callback at a time and I'll use global data. It is easy to make this a little nicer. void (*progressCallback)(int progress, void *data) = nullptr; void *progressCallbackData = nullptr; void registerProgressCallback(void (*callback)(int progress, void *data), void *data) { progressCallback = callback; progressCallbackData = data; } void updateProgress(int progress) { if(progressCallback) { progressCallback(progress, progressCallbackData); } } class MyProgressClass { public: MyProgressClass() { registerProgressCallback(std::mem_fun(&MyProgressClass::updateProgress), static_cast<void*>(this)); } void updateProgress(int progress) { //... } }; This would be the rough outline for using callbacks. I am not entirely sure about std::mem_fun (or is it std::mem_fn now?). Maybe you need an additional wrapper function to cast the void pointer back to a pointer to MyProgressClass. Maybe lambdas would work as well. Things look a little easier if you don't use a function pointer but std::function<void(int,void*)> instead. I am also not entirely sure if I got the function pointer syntax right. registerProgressCallback() and updateProgress() could also be static functions of a class together with class variables storing all callbacks and their associated data in vectors. The advantage of the void pointer for additional data is that you can just declare a struct and put all function parameters into this. Then write a wrapper function that will unwrap the data from the struct and call you progress function with an arbitrary amount of (fixed) parameters.
  • How to fit widget with set size properly for game?

    Unsolved game qgraphicsview qwidget
    2
    0 Votes
    2 Posts
    464 Views
    JonBJ
    @misscoffee So just set the size of the view and/or scene to the full size of the screen/desktop. You can also use void QWidget::showFullScreen() (see the warnings there). Be aware that widgets/windows have borders, and a title bar unless you specify otherwise, so the view/scene may not occupy every pixel of the screen, unless you take action, if that matters to you. IIRC, graphics scene/view places coordinate (0,0) in the center with x,y increasing right/up. You can use setSceneRect() to alter this.
  • Detect in CMake DEBUG. How?

    Unsolved
    3
    0 Votes
    3 Posts
    507 Views
    goldenhawkingG
    Using this script to display all CMake status paras. get_cmake_property(_variableNames VARIABLES) foreach (_variableName ${_variableNames}) message(STATUS "${_variableName}=${${_variableName}}") endforeach()
  • Bug in the Mandelbrot example?

    Unsolved
    3
    0 Votes
    3 Posts
    251 Views
    M
    @maliberty said in Bug in the Mandelbrot example?: we break out of the loop immediately So not "immediately" but quickly enough.
  • Bluetooth (USB) local adapter power off ?

    Unsolved
    1
    0 Votes
    1 Posts
    175 Views
    No one has replied
  • How to make a QLayout ignore the space of a widget that has 0 height?

    Solved
    5
    0 Votes
    5 Posts
    639 Views
    JoeCFDJ
    @Ylvy there are default top and bottom margins in the layout as well. Set them to 0.
  • 1 Votes
    12 Posts
    5k Views
    bashtianB
    @Guy-Gizmo thank you very much for the answer, I will check it out, the click throu doesnt work at all on my mac, I will ttry to sort that out and see if I can combine both to achieve that effect.
  • Not getting Windows IME events when emoji is selected from Windows Emoji popup.

    Unsolved
    1
    0 Votes
    1 Posts
    224 Views
    No one has replied
  • Undefined reference to 'gt_version_tag'

    Unsolved
    7
    0 Votes
    7 Posts
    502 Views
    JoeCFDJ
    @Shamit-Biswas /home/pc_name/Qt/5.13.2/gcc_64/lib/ is not added in the lib path. Do the following; export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/pc_name/Qt/5.13.2/gcc_64/lib If your installed Qt version overrides the Qt version with Linux distribution, do this: export LD_LIBRARY_PATH=/home/pc_name/Qt/5.13.2/gcc_64/lib:$LD_LIBRARY_PATH BTW, do not install Qt under /home/pc_name since it is user name dependent. Better to install it under /opt/
  • Secure Qt 6.5 Application. How?

    Unsolved
    1
    0 Votes
    1 Posts
    177 Views
    No one has replied
  • Qt build problem with accents

    Unsolved
    2
    0 Votes
    2 Posts
    296 Views
    C
    What you have in the path is a UTF8 encoded file name being treated as if it is Win-1252 encoded (ISO 8859-1 Latin 1) or similar. This is likely a Windows code page issue, and a very common issue on Windows. Does the file path look right in a DIR C:\Users output? Does that change, or your build change, if you execute chcp 65001 (which sets a somewhat limited UTF-8 encoding) in the CMD your run make from?