Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • QJsonObject: Access Element tree

    Solved
    3
    0 Votes
    3 Posts
    1k Views
    F
    @mrshawn thank you so much! That's perfect!
  • Application output “...exited with code -1073741511”

    Solved
    5
    0 Votes
    5 Posts
    1k Views
    Q
    Hi It was a GCC/G++ version problem. I was trying to build it with gcc-version-9 and the software was built originally with gcc-version-8.3 So, trying to bring the system to a previous gcc version either from within MSYS or with the insternal Qt MinGW compiler. Thanks!
  • How to reverse an string?

    Solved
    3
    0 Votes
    3 Posts
    6k Views
    RipleyR
    @Gojir4 thanks bro.
  • Adapt different display size?

    Solved
    9
    0 Votes
    9 Posts
    1k Views
    ahsan737A
    it's done. I was missing this trick. Font ratio was 0 for my device so it was applying default value. if (m_ratioFont < 1.) { m_ratioFont = 1;
  • QTimeEdit set unselectable

    Unsolved
    4
    0 Votes
    4 Posts
    385 Views
    M
    I had the same problem and made a subclass QLineView derived from QLineEdit tellsubway. Then, i reimplemented void setReadOnly(bool) and added a member var QPalette activePalette_
  • How to work with time intervals in Qt?

    Solved
    15
    0 Votes
    15 Posts
    4k Views
    R
    @christian-ehrlicher Yeah, I read it after was commenting, my bad :D Thanks, again. Finally I did that task with QDateTime and have got results like (example here): "02:30:01.205" Press <RETURN> to close this window... or "146:30:01.205" Press <RETURN> to close this window...
  • QSortFilterProxyModel: How to display all children?

    Unsolved
    3
    0 Votes
    3 Posts
    2k Views
    ahsan737A
    @jonb said in QSortFilterProxyModel: How to display all children?: while what you want is "if a row matches, then automatically include all its descendants", right? Exactly, I want to display all the descendants once any of child has matched. Thank you for your detailed reply, I will try to implement it although it sounds a bit complicated to me (as I am a beginner).
  • QTableView QModelIndex isVisible?

    Solved
    4
    0 Votes
    4 Posts
    971 Views
    mrjjM
    @pada_ Hi The viewport draws the items. each item has a rect, and the viewport has a rect so we can use visualrect to see if an item is within the viewport and therefore visible. Does the viewport Rect of the QTableView meet the Rect of each QModelIndex you tell me? Im not 100% sure what this sentence means, but i feel like saying yes :)
  • Signal emission for destructed receiver across threads

    Unsolved
    2
    0 Votes
    2 Posts
    224 Views
    Christian EhrlicherC
    @inforathinam said in Signal emission for destructed receiver across threads: I used Qt::DirectConnection You must not use Qt::DirectConnection when you want to send signals from one thread to another. See https://doc.qt.io/qt-5/threads-qobject.html#signals-and-slots-across-threads Normally you don't need to specify the connection type at all - Qt knows which one it has to use.
  • What to subclass?

    Solved qsqlquerymodel subclassing model-view editable model
    9
    0 Votes
    9 Posts
    2k Views
    Pl45m4P
    @christian-ehrlicher said in What to subclass?: Especially compared to the idea to parse the data somehow from a sqlite file Where I have said that? :) I never had the idea to "parse" the sqlite file directly. I will try to get the data with a query first and see what I can do with it :) (I guess QSqlResult is the key?!)
  • Application with overlay and trayicon but no mainwindow

    Solved
    11
    0 Votes
    11 Posts
    1k Views
    T
    Thanks @hskoglund feeling good to not be alone, I guess I will keep going that way, just feel weird :D
  • QSqlError("", "Parameter count mismatch", "")

    Solved
    8
    0 Votes
    8 Posts
    746 Views
    zhmhZ
    @christian-ehrlicher you said Right It's solved ,tnx
  • 1 Votes
    5 Posts
    5k Views
    Chris KawaC
    There are what, three or four different coordinate systems at play here? Three. View coordinates, scene coordinates and item coordinates. I'm coming from a reference point of just dealing with basic painting where (0,0) is always the top-left point Then what you know translates directly to scene coordinates. On top of that is the view and scene can be moved freely in it so scene 0,0 and view 0,0 are not the same. Since you set alignment the scene is moved inside the view so that the top left most item is in the corner. This moves 0,0 of the scene outside of the view in your case. Oh, and by the way, scene->addRect(50,50,20,20) does not draw rectangle at 50,50 like you said, it is drawing it at 0,0, every time It adds item to scene and in scene coordinates it has position 0,0. If you print out item->pos() it will show 0,0 as items are always placed in the scene. What you see is the result of alignment that causes the scene to be shifted in view coordinates. Pictures would really help here Here you go. Note that those pictures show a view without alignment set, to show that scene and view 0,0 are not the same. The numbers are in scene coordinates. If you do scene->addRect(50,50,20,20) the result is this: [image: y4mbjxpF-egRb1JLzv_84-tnukFyHTeTijhszmf2wV48rmMUi8Z_JMLbkVv-xxeifSUxXD5fKgXcMBX-UQNOqim12uYMVcmHHhQKfY8RUVkv76MgWyW6g65u-_VcwGoaLkZcvnOiK-39i3ZGDrq4iArTQj2_aaCL4WVvHeNQ1U8ySvPock3GNaAyGTNh2Kj_GlaWWD89ZTzkX1h0fedltIv6g] The dotted lines are the 0 axes of the scene. The red point is the item origin point and it's in 0,0 of the scene. All item transformations are done using that point. You set it via item->setPos(), item->setTransform() and the likes. The red rectangle is the relative bounding box of the item. In case of a QGraphicsRectItem it grows to encompass the actual black rectangle visible on the screen. That red rectangle is going to resize as you change the geometry of your rectangle via item->setRect(). The black box is the rectangle drawn by the item. It is set to have an origin at 50,50 in item's coordinates, so relative to the red point (item origin). Now, if you do auto rectItem = new QGraphicsRectItem(0,0,20,20); rectItem->setPos(50,50); scene->addItem(rectItem); the result is: [image: y4m2L2GpprocoPqa4raSH3y2BhM8wDFu7xn9GzkwL_f-o4y2Jeihwj1xAC_ZpedtA3aLjeQcIe2q6xxK0IBZGDSlctH0LWIpywv1PZZnCcn_5poj3ZLvwrcxToKme8gSD9RNWRVIinXZ7hyQX_diFKscPASjgd8gqzeVwPlVubm8IFl9Xlgvs0DNvhuVH8_d00XinjsuSuTQnzBwk4SXR2xZw] This creates an item, again in 0,0 in scene coordinates then moves it to 50,50. The item itself draws a black rectangle at 0,0 in item coordinates.
  • WebSocket - Who is the "server" and who is the "client"?

    Solved
    5
    0 Votes
    5 Posts
    447 Views
    B
    @christian-ehrlicher Ty, that's all I need.
  • QFileSystemWatcher signal connection give weird error.

    Solved qfilesystemwatc
    3
    0 Votes
    3 Posts
    606 Views
    D
    Pricelesss.... Thanks!
  • QTableView::selectionChanged connect with C++11 lambdas

    Unsolved
    7
    0 Votes
    7 Posts
    3k Views
    Christian EhrlicherC
    @infinity said in QTableView::selectionChanged connect with C++11 lambdas: How can I set the model to single selection? By taking a look into the documentation: https://doc.qt.io/qt-5/qabstractitemview.html#selectionBehavior-prop
  • Question about QAbstractItemModel::canDropMimeData()

    Solved
    6
    0 Votes
    6 Posts
    924 Views
    R
    @christian-ehrlicher : And thanks for the link to the fantastic woboq.org site which was new to me. All the sources are hyperlinked, so it is very easy to navigate!
  • "İ" problem in QSortFilterProxyModel?

    Unsolved
    4
    0 Votes
    4 Posts
    424 Views
    Christian EhrlicherC
    @snorkelbuckle said in "İ" problem in QSortFilterProxyModel?: so maybe your string needs to be in unicode format? That's the reason I would guess - the string is not properly encoded since either the source code is not utf-8 or the compiler does not understand it. Therefore only use ascii in your code and translate the rest with linguist.
  • This topic is deleted!

    Unsolved
    12
    0 Votes
    12 Posts
    142 Views
  • Print two separate pages

    Solved
    7
    0 Votes
    7 Posts
    842 Views
    I
    @sgaist I want to print a page of the stack widget that has the scroll bar This page contains line Edit, Push Button It's solve with : QPixmap pix = ui->scrollAreaWidgetContents->grab();