Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.6k Posts
  • [SOLVED] Get extension of a file in Qt

    15
    0 Votes
    15 Posts
    25k Views
    W
    @ashishbansal said in [SOLVED] Get extension of a file in Qt: But that too is not gonna work. Like in foo.bar.tar.gz, extension is tar.gz but it would give me bar.tar.gz Basically any library would have "bar.tar.gz" as the full extension for "foo.bar.tar.gz" -- there's nothing about the filename itself that makes bar and tar obviously distinct. So the only way to have tar.gz get picked out as special is try to try have a giant database of every possible file extension in the universe. And even if you had that, it would give unintuitive/inconsistent results tomorrow when somebody came out with a new one and it started seeing some but not others. In practice, pretty much every general purpose library is just going to be splitting the name using generic rules.
  • Qt3D: Change the color of transparent parts of a texture image.

    Unsolved
    1
    0 Votes
    1 Posts
    190 Views
    No one has replied
  • Valgrind unsupported socket operation

    Unsolved
    9
    0 Votes
    9 Posts
    1k Views
    T
    @aha_1980 Any thoughts on this matter? I struggled with this too which is why I switched to Windows/HOEB.
  • MousePressEvent not triggered if QWidget on top of Gnome left panel on Ubuntu 18.04

    Unsolved
    3
    0 Votes
    3 Posts
    288 Views
    K
    To be honest I never tried to compile my app with Qt 5.5 on Ubuntu 18.04. The issue was not showing on Ubuntu 16.04 (unity) on Qt 5.5, but is showing on Ubuntu 18.04 (gnome) (but OK in KUbuntu 18.04 as no left panel is under my QWidget) with Qt 5.9, 5.13. With Qt::X11BypassWindowManagerHint set, I'm not sure I can say it is a bad gnome behavior, or an unexpected one on Qt-side as the Window manager is supposed to be bypassed... At least, I think it is comfortable to say it is gnome-related...
  • Best way to access user help for small application

    Unsolved
    5
    0 Votes
    5 Posts
    382 Views
    P
    Thank You again for your time and help. I cant see anywhere that I dont pass the parent parameter, other then the modeless dialog that I needed for the staff details. In the end I used QProcess to start a separate process to enable the staff details to be loaded and modified. I then use QProcess->terminate() to close that process (both Unix and windows) and catch(signals in unix) any edits. I preferred your solution, it would have been much simpler, but this was not to bad in the end and seems to work well. Thank You so much again. If I get time I will experiment with your suggestion again. Thank You.
  • WebEngine/WebEngineWidget lost in Qt 5.13.1

    Solved
    3
    0 Votes
    3 Posts
    338 Views
    MucipM
    @jsulm, Pardon me. You were right. I installed it via Maintenance tool and now it's ok... :) Regards, Mucip:)
  • fill QTableView with items from lineedit

    Solved
    17
    0 Votes
    17 Posts
    4k Views
    VRoninV
    [image: giphy.gif]
  • Scroll tab bar without activating tabs

    Unsolved tabs qtabbar qtabwidget scroll qtabbar
    1
    0 Votes
    1 Posts
    466 Views
    No one has replied
  • How to return to a previous state using QStateHistory with nested states?

    Solved
    4
    0 Votes
    4 Posts
    768 Views
    M
    OK, I found what was wrong. I needed to set the history type with this function: s0h->setHistoryType(QHistoryState::DeepHistory); from the documentation page of QHistoryState: https://doc.qt.io/qt-5/qhistorystate.html
  • How to position buttons on QMessageBox?

    Unsolved
    2
    0 Votes
    2 Posts
    1k Views
    SGaistS
    Hi, You can do simpler: QDialogButtonBox. That class does the work for you.
  • This topic is deleted!

    Unsolved
    5
    0 Votes
    5 Posts
    27 Views
  • signal interval question

    Solved
    4
    0 Votes
    4 Posts
    368 Views
    jsulmJ
    @clementNg connect(horizontalSliders, &SlidersGroup::valueChanged, [=](int value){ QTimer::singleShot(200, [=](){ this->ui->valueSpinBox->setValue(value); }); }); No need to disconnect as singleShot does not connect anything.
  • How to Render displayed horizontal and vertical header of QTableView

    Solved
    3
    0 Votes
    3 Posts
    384 Views
    V
    you are right @JonB . It works using stylesheet. Thank you
  • QSettings

    Unsolved
    4
    0 Votes
    4 Posts
    1k Views
    JonBJ
    @satyanarayana143 For an example of how to save JSON via QSettings you might read through https://stackoverflow.com/questions/42060573/save-ui-settings-with-qsettings-or-qjson. There are known issues with QSettings which might occur with a JSON entry. Also, your JSON will probably have newlines in it, I don't know whether QSettings handles this for you (I think settings entries in the file have to be on one line), and/or "special" characters in the JSON which just might trip QSettings up. If it all works as-is, fine. If not, just be aware that you could always use https://doc.qt.io/qt-5/qbytearray.html#toBase64 to encode the JSON before saving, and https://doc.qt.io/qt-5/qbytearray.html#fromBase64 to decode upon reload, if required and that solves issues.
  • qtextbrowser update from different class

    Solved
    10
    0 Votes
    10 Posts
    1k Views
    jsulmJ
    @Trojan-Arun I already explained you that you are creating a LOCAL variable "text". Are you aware of that? Make "MainWindow text" member variable in your emittertest class...
  • QComboBox setCurrentIndex() crash upon calling

    Unsolved
    2
    0 Votes
    2 Posts
    487 Views
    jsulmJ
    @qt-1234 said in QComboBox setCurrentIndex() crash upon calling: ui->combobox->setCurrentIndex(1); How many elements do you have there? If only one then 1 would be out of range. Is ui->combobox a valid pointer? Also, what kind of crash is it? Did you debug? Do you have a stack trace after crash?
  • how to add line break in qmake function

    Solved
    3
    0 Votes
    3 Posts
    830 Views
    S
    @aha_1980 Thank you very much, first. I got a way by my team: for(file, src_files) { # replace slashes in source path for Windows win32:file ~= s,/,\\,g QMAKE_PRE_LINK += $$QMAKE_COPY_DIR $$shell_quote($$file) $$shell_quote($$dst_dir) $$escape_expand(\\n\\t) }
  • 0 Votes
    3 Posts
    715 Views
    D
    Bump as I re-edited the topic with new info from "scratch"
  • QImage from raw array of RGBA32floats ?

    Solved qimage
    11
    0 Votes
    11 Posts
    2k Views
    D
    @SGaist said in QImage from raw array of RGBA32floats ?: Hi, ARGB32 is 4 bytes hence the 32. So in your case it would rather be ARGB128. Argh this explains my confustion! Yep thats it thanks! @wrosecrans said in QImage from raw array of RGBA32floats ?: @Dariusz said in QImage from raw array of RGBA32floats ?: Format_ARGB32 Yup, that's 32 total bits per pixel, not 32 bits per channel like the GL_RGBA32F notation in OpenGL. And even then, there are also 32 bits per channel integer pixel formats that still aren't floating point. So even if you do see a 32 bit per channel format, you can't assume it's floating point if it doesn't say it explicitly. (Admittedly those aren't especially common, but formats like OpenEXR support them, and you'll sometimes see them used for things like Object-ID channels in 3D renders) Basically, every image handling API covers more or less the same basic functionality, but just different enough to make you want to rip your hair out when you try to use them together. It's not even like nothing in Qt can deal with floating point. QOpenGLFrameBufferObject supports OpenGL format names: https://doc.qt.io/qt-5/qopenglframebufferobjectformat.html#internalTextureFormat and can be FP internally. Then if you try to get a QImage from an FBO using toImage https://doc.qt.io/qt-5/qopenglframebufferobject.html#toImage-1 it will know how to do the pixel format conversion to 8bpc. You just can't get the raw FP data in a QImage. shrug. This stuff is always more work than you expect, mostly for no good reason. Argh too sounds about right! Looks like I will either have to build my own image library for format/data handling or perhaps use freeImage as my base... are there any other libraries u could recommend perhaps? I think I'll mark this issue as solved now as its Qt Limitation and me misunderstanding Qt format. Thank you all for help. Regards Dariusz
  • Why does setRange of QDateTimeAxis take so much time?

    Solved
    7
    0 Votes
    7 Posts
    734 Views
    tovaxT
    @JonB Hi, This is a very good website! Thank you very much! https://www.advsofteng.com/ Best Regards!