Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.5k Topics 457.3k Posts
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    5 Views
    No one has replied
  • QDateTimeEdit DateTimeChanged

    Solved
    12
    0 Votes
    12 Posts
    1k Views
    P
    @JonB You're right. I did a test and it does update mpStartDateTime. Thank you!
  • Slot and Signal problem custom class

    Solved
    9
    0 Votes
    9 Posts
    521 Views
    KroMignonK
    @vin212 said in Slot and Signal problem custom class: I change for : connect(window->ui->pushButton, &QPushButton::clicked,this, &MainWindowsAction::test ); and i add Q_OBJECT but i have an other error message : Yes, it's maybe this problem, i recompile and it's work Thank's for your answers After adding Q_OBJECT to a class, you need rerun moc (Meta-Object Compiler). Take a look at following links for more details! https://doc.qt.io/qt-5/moc.html https://doc.qt.io/qt-5/why-moc.html
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    5 Views
    No one has replied
  • How to align data in QTableView?

    Unsolved
    5
    0 Votes
    5 Posts
    2k Views
    JonBJ
    @CuriousPan :) While you are looking at enum Qt::ItemDataRole, see what other roles are defined. You can affect fonts, colors, tooltips.... You can also look at the passed-in QModelIndex and/or the type of QVariant returned from Qt::DisplayRole/EditRole to selectively return different values for these, e.g. only numbers should be right-aligned, strings should be left-aligned.
  • Problem drawing in QGraphicsView

    Solved
    8
    0 Votes
    8 Posts
    539 Views
    ivanicyI
    I found a solution. It was simple. I had to add scene->update() in move() function to fix it.
  • 0 Votes
    9 Posts
    688 Views
    jronaldJ
    @JonB said in How to implement visual effect for cutted item in QAbstractItemView?: So if you want whatever you need to know to be stored in the original item when it is cut, do so via setData(), then you don't need to remember/adjust the QModelIndex. You might store the desired "cut" icon either directly in setData(Qt::DecorationRole) or in your own Qt::UserRole + ... and test for that in data(Qt::DecorationRole)'s return value. Obviously whatever setData(role) value you use will need to be cleared out when the cut completes or is cancelled. I think it is the most efficient way. I'll use it. Meanwhile the pure original class is also preferred, it can be a parameter to other functions. It's likely that some convertions have to be there.
  • new window cannot direct move

    Solved
    2
    0 Votes
    2 Posts
    172 Views
    JonBJ
    @0ices Hello and welcome. I have not heard of making a window the subject of drag & drop. Nor of creating a new window in a mouseMoveEvent, that would create hundreds of them as the mouse is moved. If anything I would have thought during mousePressEvent. It sounds to me as though you are creating this new window while you are in the middle of a mouse drag event on the main window --- you already have the mouse pressed down and you are dragging it? In that situation I do not know that you can/it is easy to "change" the drag which is currently in progress over the main window so that now this new window is focused and receives mouse events. The more usual way, it seems to me, would be: create whatever this new window is first, perhaps on main window mouse down, and then initiate a drag and drop event on it.
  • This topic is deleted!

    Unsolved
    15
    0 Votes
    15 Posts
    58 Views
  • Qmake SOURCES vs @SOURCES

    Solved
    6
    0 Votes
    6 Posts
    562 Views
    O
    maybe i will open a new post with my current question its is not anymore about the @ symbol
  • What happens to widgets added to QTabWidget?

    Solved
    5
    0 Votes
    5 Posts
    445 Views
    D
    Hi, thank you for your attention and support! You're a real professional! The right question. It took me a while to get it, but - of cause - you where right. I'm getting old. I forgot the second purpose of DynWidget ancestors - late initialization. So it was a typical PEBCAK.
  • Reasons to make Q_PROPERTY's BINDABLE for QML types defined from C++?

    Unsolved
    1
    0 Votes
    1 Posts
    100 Views
    No one has replied
  • Why

    Unsolved
    6
    0 Votes
    6 Posts
    433 Views
    C
    Do a clean build of your project so that moc runs and moc_mainwindow.cpp is regenerated to match your actual MainWindow declarations in mainwindow.h (which should be on_menuBar_import_triggered())
  • How to trigger a hotkey to a QWindow using a QButton?

    Unsolved
    19
    0 Votes
    19 Posts
    2k Views
    fabriciokashF
    @SGaist said in How to trigger a hotkey to a QWindow using a QButton?: Which OS are you on ? Sending key events through Qt's event loop like that won't work AFAIK. The application while embedded is still an external application. Im using Ubuntu 18.04. There is a way to send the key event through OS?
  • QListWidget currentRow prints -1 after setting a stylesheet

    Solved
    3
    0 Votes
    3 Posts
    278 Views
    S
    Hi @JonB thanks for your response. After a deep look in my code, I found the thing that was causing this to fail. Thanks for telling me.
  • QListWidgetItem setForeground does not work with global stylesheet

    Solved
    10
    0 Votes
    10 Posts
    3k Views
    JonBJ
    @stvokr I wrote earlier @stvokr One thing: if you are saying you apply a color in code to style, that will be overridden/ignored if there is stylesheet rule applicable. Depends how you set the color of the listwidgetitem. So, yes, if you use QSS that will override setForeground() etc. You will need to stick with one or the other.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • Single Click Event on Q

    Unsolved
    4
    0 Votes
    4 Posts
    313 Views
    JonBJ
    @JonB said in Single Click Event on Q: This is not a full application, just an extract. Presumably if "the application exits" on a click there is an error, and you get an error message somewhere. ?
  • QTextEdit - how to capture the actual "selection changed " text ?

    Unsolved
    5
    0 Votes
    5 Posts
    1k Views
    A
    @JonB I still think I am using wrong widget / signal. I can only position and click the mouse. I cannot highlight the text - the positioning of mouse overrides that.
  • Add widget in code

    Unsolved
    6
    0 Votes
    6 Posts
    492 Views
    SGaistS
    tr is used for text translation. It's an old habit of mine to write my code so that translation can be implemented at anytime. As for your use case, just nuke your "tab" object and add text directly to your ui QTabWidget: ui->tabWidget->addTab(text, tr("Text Edit"));