Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • QLabel to bring middle of a QVLayout

    Solved
    3
    0 Votes
    3 Posts
    274 Views
    A
    @Swati777999 Layout haven't font setting but Any kind of Widget can be set font in Qt. For example I have QLabel type Widget QFont customFont; customFont.setItalic(true); customFont.setBold(true); customFont.setFamily("Arial Black"); customFont.setPointSize(20); QLabel *label = new QLabel("my Label"); label->setFont(customFont); for details font Or use set Stylesheet of that widget
  • Application events being processed after exit() call - bug or feature??

    Unsolved
    3
    0 Votes
    3 Posts
    539 Views
    A
    @jsulm Thank you for the clarifications!. I understand why current code works how it works. But sorry, I'm still don't understand why it is ok to process any application event after exit() call :) What if I have 2 events in list: first is user click on close application (exit() called while processing) and 2nd is message that starts long calculation process in background? I shouldn't process 2nd and this information is obvious to qt since exit flag is raised to moment when it will start processing 2nd event. Why I'm pushed to spawn redundant checks in user code instead of just do the work right in qt framework?
  • Confusion between the usage of 'this' and 'parent'

    Solved
    55
    0 Votes
    55 Posts
    10k Views
    JKSHJ
    @Pl45m4 said in Confusion between the usage of 'this' and 'parent': @JKSH sry :) Missed the sentence in your reply where you also said that No prob! It's good to have multiple confirm the same thing
  • QTextDocument using TableHeaderRowCount with html contents

    Unsolved
    4
    0 Votes
    4 Posts
    292 Views
    SGaistS
    The usual way is to modify the copy and then reapply it.
  • Getting info of camera devices.

    Solved
    11
    0 Votes
    11 Posts
    1k Views
    SGaistS
    Hi, Then you need to use the SDK provided with pylon. There's everything there to enumerate the cameras connected to your system as well as grab images from them.
  • In Qt Creator "Design editor", how to nudge in grid view by 1px?

    Unsolved
    1
    0 Votes
    1 Posts
    131 Views
    No one has replied
  • Clear previous drawings on repaint

    Unsolved
    5
    0 Votes
    5 Posts
    420 Views
    JoeCFDJ
    change your window size setGeometry(0, 0, 950, 550); When I run your code, I can not stop it. It uses full screen of my terminal. I have to restart machine. I do not see your problem on Ubuntu 18 with Qt 5.15.2.
  • Sending and receiving data from/to PC/Arduino through serial port using QT

    Moved Unsolved
    13
    0 Votes
    13 Posts
    2k Views
    JonBJ
    @DanAm said in Sending and receiving data from/to PC/Arduino through serial port using QT: One general question : to send through serial port, do we need to stream the byte array (QByteArray type) using QDataStream or we can write the array in the port directly ? Either, you do not have to use QDataStream.
  • How do I put a QLayout in a QWindow?

    Unsolved qt5 qt5.11
    2
    0 Votes
    2 Posts
    681 Views
    JonBJ
    @timob256 Cross-referenced from your other thread at https://forum.qt.io/topic/132655/how-to-embed-ogre3d-in-qt5-as-a-widget. A QWindow is not derived from a QWidget, so, no, you cannot put a QLayout on it. Docs say: The QWindow class represents a window in the underlying windowing system. So you do not set extra buttons or charts or whatever on a QWindow. You may know better than I, and I don't know how it relates to your "Ogre" situation, but you may want to read through What is the difference between a QWindow and QWidget and maybe Introducing QWidget::createWindowContainer() too. Qt: layouts with a Qwidget window container talks about layouts too.
  • Reading array qt tcp socket

    Unsolved
    8
    0 Votes
    8 Posts
    742 Views
    VRoninV
    From https://wiki.qt.io/WIP-How_to_create_a_simple_chat_application: The first thing to remember is that when we receive the readyRead we can't make any assumption on how much data is available, the signal only tells us some data is there hence there are 4 cases we need to handle: The socket did not receive enough data to be a complete message, we only received a partial There is exactly enough data in the socket buffer to read a message There is more than enough data in the socket buffer to read a message but not enough to read 2 messages There is enough data in the socket buffer to read multiple messages
  • Qt application managed from web browser

    Unsolved
    2
    0 Votes
    2 Posts
    195 Views
    VRoninV
    @ivanicy said in Qt application managed from web browser: Is it possible to do it or something like that?? Yes: https://doc.qt.io/qt-6/wasm.html Not the real question is "should you"? I the web inerface is all your app has then the answer is no. If your app is mainly compiled (desktop/mobile) but want to have a plan-B access through the web to it without having to rewrite it from scratch then this is the way to go
  • 0 Votes
    1 Posts
    102 Views
    No one has replied
  • Interaction between threads and GUI

    Solved
    8
    0 Votes
    8 Posts
    1k Views
    D
    @JonB Yeap, thank you very much I will try it
  • How to embed Ogre3d in qt5 as a widget

    Unsolved qt5.11 qwidget ogre
    6
    0 Votes
    6 Posts
    1k Views
    JonBJ
    @timob256 said in How to embed Ogre3d in qt5 as a widget: QWindows not unit setLayout ? install in element, not posible. Don't know what this means. this->setLayout(gl_layaout[3]); // this not work !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Don't know what this means. All your widgets are created with parent as their parent, instead of this. Since I wrote earlier But why are you using parent here? Shouldn't it be this? do you not think this applies to your case? Why? You are creating your widgets with a parent of parent of QTOgreWindow, and then this->setLayout(gl_layaout[3]); setting the layout on this. I don't get what you are trying to do or why. UPDATE I see you have now taken this question to https://forum.qt.io/topic/132674/how-do-i-put-a-qlayout-in-a-qwindow. It's always helpful to others if you cross-reference posts like this. I see now that my "But why are you using parent here? Shouldn't it be this?" is not applicable to QWindow. I will post into your other thread.
  • Run bash script from qt

    Solved
    13
    0 Votes
    13 Posts
    6k Views
    JonBJ
    @Wasee @jsulm's code is correct. However, there will be a "wrinkle" if your someParameter argument has any spaces in it. I don't want to complicate things unnecessarily, so if that is the case let us know, otherwise just follow that code.
  • Rewrite a file content in an existing file.

    Solved
    26
    0 Votes
    26 Posts
    2k Views
    S
    If you are using a password manager or drive encryption the secret (i.e. the actual key) is protected by a password, i.e. the password is used for encryption of other passwords or keys. This also means that you need to type in the password to decrypt the data. Without user interaction this approach will not be able to access any secured data. All other software I know of stores passwords or keys directly; either as plain text or maybe obfuscated (like @artwaw suggested). There is no other protection. This means that everyone who can access the data has access to passwords or keys. Like I said already, SSH keys are store plain in the users folder. What is the protection here? The simplest way to protect this data is access privileges. By default the user's home directory is only accessible by the user (and also root or any super user can easily gain access). This is safe as long as no one rips out your hard drive and puts it into their computer where they control who has access to which files. The only way to prevent that is file system encryption. File system encryption means that you have to enter the password every time you mount the filesystem (usually at startup). Still, root and any super user can get access to this data. If you think of your key more like a regular password, you should read up on password hashing. Use a random salt to hash the password and then store the salt and the hash. When the user enters the password again, combine it with the stored salt and hash it again. If the hash matches the user entered the correct password. However, this approach always required interaction from a person. If you want to decrypt autonomously you have to store the key plainly (or obfuscated) somewhere. Your best bet is to use system api secure storage like @artwaw suggested. Also: Using the MAC for encryption is also just obfuscation as this is a well known "secret" anybody can figure out. Finally: Security through obscurity is no real security at all.
  • Find Data Value with Mouse on a QtChart

    Unsolved
    4
    1 Votes
    4 Posts
    2k Views
    jsulmJ
    @WesLow said in Find Data Value with Mouse on a QtChart: Confused about the last parameter Last parameter is the pointer to slot: connect(seriesName, &QXYSeries::hovered, yourClassInstancePointer, &YourClassName::displayPlotValueFunction);
  • Expose Q_PROPERTY variable in QT Designer?

    Solved
    5
    0 Votes
    5 Posts
    488 Views
    C
    @mpergand That's good to know, I'll stick with using dynamic properties after all. Thinking I would have to add these manually to each widget I want? Couldn't be as easy as setting a dynamic property for say a class and use that and have it show up in Qt Designer.
  • QTableView + QStandardItemModel + custom delegate = strange behaviour

    Solved tableview delegate
    3
    0 Votes
    3 Posts
    880 Views
    artwawA
    @SGaist You are, as usual, right and I am the absolute moron :D I forgot to take into the account starting point of the cell in paint... Too much time has passed since I had to write the delegate it seems. The solution of the problem was correcting the drawPixamp starting point (add opt.rec.x() and opt.rect.y() respectively): painter-drawPixmap(QPoint(opt.rect.x()+opt.rect.width()/2,opt.rect.y()+opt.rect.height()/3),px.scaled(opt.rect.width(),opt.rect.height()/2,Qt::KeepAspectRatio,Qt::SmoothTransformation)); Thank you for this quick reminder! Cheers, A.
  • QLabels and QMainWindow have different size on app executing and design view

    Unsolved
    2
    0 Votes
    2 Posts
    132 Views
    SGaistS
    Hi, Are you using layouts to build your UI ?