Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • Positioning QlineEdit on a QWidget without Layout Manager

    Unsolved
    12
    0 Votes
    12 Posts
    2k Views
    A
    As it turns out - using QSpacerItem for this task is not so trivial, at least not to me... At this point, you probably figured out what I am trying to do. I have a DWORD (which is actually a LineEdit - a subclass of QLineEdit), of width W points. The DWORD's "Fields Layout" (not to be confused with Qt's Layout Managers) is a QVector describing the breakdown of the DWORD: typedef std::pair<QString, int> Field; typedef QVector<Field> FieldsLayout; Where the QString is the name of the Field, and int is its bit-size. Assume that an instance of FieldsLayout always sums up to 32. In other words: // let 'fieldsLayout' be an instance of FieldsLayout int sum = 0; for (int i = 0; i < fieldsLayout.size() i++) sum += fieldsLayout[i].second; assert(sum == 32); // this assertion never fails Now suppose 'labels' is an instance of QVector<QLabel*>: QVector<QLabel*> labels; for (int i = 0; i < fieldsLayout.size() i++) labels.push_back(new QLabel(fieldsLayout[i].first)) Given the above, my goal is to have labels[i] span over fieldsLayout[i].second * W/32 points, and be positioned above its corresponding bits in the DWORD. Something along the line of: [image: aa58e59c-4595-4138-84b7-722928764483.png] Maybe I don't even need QSpacerItems? Maybe all I need is making sure that each QLabel spans over the correct amount of W/32? If so, how can that be achieved? Please advise. Thanks! CORRECTION I don't want the QLabel to span over the correct amount of W/32 (I just realized it's easy - all I need is to set the QLabel to a fixed size of fieldsLayout[i].second * W/32), but rather I want it to be positioned in the center of the correct amount of W/32: [image: 696a96d3-7215-4fe1-8f0f-2b8bde91c43f.png] (The QLabel should take the minimum size it needs to display the text, and to be in the center of fieldsLayout[i].second * W/32 space)
  • deleting a QMap after clear()

    Unsolved
    5
    0 Votes
    5 Posts
    511 Views
    Christian EhrlicherC
    And to complete it all together - there is no need to create a QMap on the heap at all in most of the cases.
  • Noobie tutorial and 5.11 to 5.12 upgrade

    Solved
    23
    0 Votes
    23 Posts
    6k Views
    aha_1980A
    @cmwDev woo-hoo! I'm glad you finally solved it. Regarding MS... no, I won't give a comment. Enjoy coding!
  • Animated custom menu

    Unsolved
    9
    0 Votes
    9 Posts
    4k Views
    J
    @mrjj @Taz742 Can you help me create a tabview vertical menu with icons on QML, just like this image? [image: 753ea4d7-9c9c-4fbd-9409-953bfaf033c1.png]
  • Analysing simple codesnips

    Solved
    23
    0 Votes
    23 Posts
    4k Views
    tomyT
    @mrjj OK, thanks so much.
  • How to convert document from Word to HTML

    Unsolved
    1
    0 Votes
    1 Posts
    405 Views
    No one has replied
  • How to use widgets designed in UI designer?

    Solved
    4
    0 Votes
    4 Posts
    516 Views
    mrjjM
    @incam Yes if you want to use promotion, then you need the .h file. (from Qt Designer Form Class) The stand alone UI file can be used with http://doc.qt.io/qt-5/quiloader.html but you can not visually add it in another form as promotion does.
  • Set font for headers in QTableWidget

    Solved
    2
    0 Votes
    2 Posts
    2k Views
    G
    @GrahamLa This was caused by a style sheet setting for all QHeaderView's
  • Qt Creator font rendering issue on macOS Mojave with external monitor

    Unsolved
    7
    0 Votes
    7 Posts
    1k Views
    aha_1980A
    @Mr.AliReza We had such a problem recently on Windows QTCREATORBUG-21758 and there it was related to the graphics system. Do you have zooming enabled, because you have a High-DPI screen? My monitor has 3440 x 1440 resolution So both monitors have this resolution?
  • QStyledItemDelegate subclass for drawing QSlider behaves strangely on macOS

    Unsolved
    5
    0 Votes
    5 Posts
    829 Views
    MrBoltonM
    Just a quick update: I did as you told, the report got closed as a duplicate just an hour later. Well, well.
  • 0 Votes
    4 Posts
    1k Views
    J.HilkJ
    @ravi2k18 said in error: expected constructor, destructor, or type conversion before ‘enum’ while building in linux with make: DiscoveryThread(); you're derving from QThread/QObject make this a proper constructor with base class initialisation
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    6 Views
    No one has replied
  • Error Theme Color in QT Creater after updated MACOS 10.14

    Unsolved
    5
    0 Votes
    5 Posts
    698 Views
    Pham HoangP
    hi. any helps on this issue?
  • QTBUG-54180 havn't been resolved in 5.9

    Unsolved
    12
    0 Votes
    12 Posts
    1k Views
    aha_1980A
    Hi @Henry-L, as said before, please comment at the bugreport if you want an improvement. The discussion here will be forgotten in a couple of days.
  • Video record from camera on windows10

    Unsolved
    13
    0 Votes
    13 Posts
    3k Views
    T
    @Dimple I was having the same issue and I was not able to record the video on Windows machines but I did also try on Linux machine it worked. I think we can't able to record a video on Windows machines using a qt. these may help: https://forum.qt.io/topic/74588/record-sound-and-video-using-qmediarecorder https://forum.qt.io/topic/97786/unable-to-run-qt-camera-example-on-qt-5-9-1
  • Does Qt support Mac-style pop-out widgets?

    Unsolved
    6
    0 Votes
    6 Posts
    2k Views
    SGaistS
    Hi, It's a NSPopover. However you might be able to integrate it into your Qt application. Here you have an example on how to show on programmatically using Objective-C.
  • building and running qt project in cli with VS 2015

    Unsolved
    12
    0 Votes
    12 Posts
    4k Views
    aha_1980A
    @ravi2k18 said in builing and running qt project in cli with VS 2015: 0xc000007b Looks like the program has a 32bit/64bit DLL mismatch. Find more here: https://stackoverflow.com/questions/28299246/0xc000007b-error The accepted answer there uses Process Monitor to watch the loaded DLLs
  • Allowing user to edit freely in a constrained (HTML?) template

    Unsolved
    2
    0 Votes
    2 Posts
    309 Views
    SGaistS
    Hi, Sounds a bit like you could have a widget providing the editable parts and then use something like grantlee to generate your report based on a template.
  • How to add fbx autodesk sdk libs and headers to a qt project (mac OS) ?

    Moved Unsolved
    4
    0 Votes
    4 Posts
    472 Views
    SGaistS
    Glad you found a solution and thanks for sharing ! Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)
  • 0 Votes
    2 Posts
    961 Views
    SGaistS
    Hi and welcome to devnet, Qt uses native system call for that task so it returns whatever Windows wants to communicate about the hardware. However listing and accessing are likely two different independent aspects.