Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • QPlainTextEdit

    Solved
    3
    0 Votes
    3 Posts
    175 Views
    D
    It works with this code below!! < pte1 = new QPlainTextEdit("hello\r\nsdan\nhow r\nyou\nhi\nthis was him dan\r\n And\nhello\nagain \ndkd\naee\nwa\ndaf" "\nAnd his this is a long long long text which has to cross the widget width andersonkddkdkdk show line wrap mode function to test", this); pte1->setGeometry(10, 10, 400, 100); pte1->setBackgroundVisible(true); pte1->setCenterOnScroll(true); pte1->setCursorWidth(3); pte1->setDocumentTitle("Dan Document"); // pte1->setLineWrapMode(QPlainTextEdit::NoWrap); // pte1->setMaximumBlockCount(10); pte1->setOverwriteMode(false); pte1->setPlaceholderText("Shows Status here"); pte1->setWordWrapMode(QTextOption::WordWrap); connect(pte1, SIGNAL(cursorPositionChanged()), this, SLOT(cpc1())); pt1.setX(10); pt1.setY(4); QTextDocument *td1; td1 = pte1->document(); // pte1->setUndoRedoEnabled(true); // pte1->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard | Qt::TextSelectableByKeyboard); // pte1->setTabStopDistance(200); // pte1->setTabChangesFocus(true); // pte1->setPlainText("Hei Dan"); // pte1->setDocumentTitle("Hi dan doc"); // pte1->setReadOnly(true); qDebug() << "block count: " << pte1->blockCount(); qDebug() << "Doc Title: " << pte1->documentTitle(); qDebug() << "Plain Text: " << pte1->toPlainText(); qDebug() << "Anchor at 20: " << pte1->anchorAt(QPoint(0, 0)); qDebug() << "Can Paste? " << pte1->canPaste(); qDebug() << "CurCharFmt: " << pte1->currentCharFormat(); qDebug() << "Cur Rect: " << pte1->cursorRect().x() << " " << pte1->cursorRect().y(); qDebug() << "doc: " << td1->toPlainText(); qDebug() << "isUndoRedoEn? " << pte1->isUndoRedoEnabled();
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • QProgressBar

    Solved
    3
    0 Votes
    3 Posts
    220 Views
    D
    @Bonnie Thank you bonnie.
  • tst_testdigitron.moc file not found

    Moved Unsolved
    5
    0 Votes
    5 Posts
    519 Views
    L
    Hey, I find a solution. Looking at this picture, StringJoin and TestStringJoin are two subprojects. You just need to execute the build command of the entire project( TestDemo here), then you'll get the moc file. Forgive me for my bad english. [image: b78fadad-bd0b-431f-96aa-13d9e0b0dbca.png]
  • Set LastModified date of file

    Solved
    16
    0 Votes
    16 Posts
    11k Views
    S
    @samdol said in Set LastModified date of file: It works fine for english filename. But if the filename contains some chinese charactors then it gives an error For future reference: By default char* on Windows uses the local 8 bit encoding (which means path.toLocal8Bit().constData() was correct and the local encoding on Linux is already UTF-8). In order to use toUtf8() on Windows you need to call setlocale(LC_ALL, ".UTF8") (preferrably once at the beginning of main). (If you also want to print UTF-8 characters to the console, you'll also need to set the UTF-8 codepage.)
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    8 Views
    No one has replied
  • How do I resize a QGraphicsView to show the whole QGraphicsScene?

    Solved
    14
    0 Votes
    14 Posts
    2k Views
    A
    @DL5EU See documentation of QGraphicsItem::setScale: The scale is combined with the item's rotation(), transform() and transformations() to map the item's coordinate system to the parent item. So in order to see the actual size, you can use auto scaledRectSize = item->mapToParent(item->boundingRect()).boundingRect().size(); Take the item's boundingRect (in item coordinates) Map the rectangle to parent coordinates Since the result is a QPolygonF (after all, rotations could be involved in the coordinate transformation), we take QPolygonF's boundingRect (since we know no rotation is actually involved) Then we take it's size Recommended reading: https://doc.qt.io/qt-6/graphicsview.html#the-graphics-view-coordinate-system
  • QDomDocument::setContent() and error parsing

    Solved
    13
    0 Votes
    13 Posts
    2k Views
    Christian EhrlicherC
    QXmlStreamReader is for reading xml, not for validating. You have to use another 3rd party library.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    15 Views
    No one has replied
  • grabWindow always returns null QPixmap

    Unsolved qpixmap grab
    14
    0 Votes
    14 Posts
    2k Views
    Z
    Is it under x11 or wayland ?
  • Basic C++/QML desktop app code review request

    Unsolved
    6
    0 Votes
    6 Posts
    305 Views
    SGaistS
    There are less constraints. Check for LGPL compatibility.
  • Get the information about the drives

    Unsolved
    6
    0 Votes
    6 Posts
    272 Views
    SGaistS
    @oneeyeman1 you might want to check KDE's Solid framework.
  • QProcess with ffmpeg is not working

    Solved qprocess ffmpeg
    5
    0 Votes
    5 Posts
    1k Views
    JonBJ
    @DungeonLords What is your question? Your code runs a bash -c "....", which is fine. Your linked output shows libGL errors. What happens if you run ffmpeg -y -f lavfi -i testsrc=size=1280x720:rate=1:duration=10 -vcodec mjpeg -pix_fmt yuvj422p -f mjpeg input.yuvj422p from a shell? If that errors what is the relevance of Qt or QProcess?
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    9 Views
    No one has replied
  • Deleting a shared object

    Solved
    21
    0 Votes
    21 Posts
    3k Views
    deisikD
    I've been using this setup (i.e. using an object in different threads) extensively these days, and sequential propagation via SLOTS/SIGNALS (whether it is addition operation, deletion operation, or whatever) is the way to go It helps keep things simple and predictable
  • a file open dialog sux

    Unsolved
    7
    0 Votes
    7 Posts
    355 Views
    Pl45m4P
    @crypt said in a file open dialog sux: non-Windows opensource OS Interesting way to describe Linux or linux kernel based systems :)) The linked thread shows that this behaviour is also in GTK File Dialogs?! And as far as I know on Ubuntu you have this type of dialog behaviour in all versions, for instance. Either you navigate by mouse, or, once you type some letters, it starts searching the current directory for files with this substring and applies some sort of filter on them which hides everything else that is not matching the filter. I think it's not a bug or misbehaviour in Qt Dialogs, it's intended to work like this... Also I'm not sure if Qt on GTK based platforms isn't using the same GTK dialog? At least when QFileDialog::DontUseNativeDialog is not set, otherwise it renders its own QWidget - based dialog. (The native one is also a QWidget but AFAIK it invokes the native one by requesting the underlaying platform to show a FileDialog)... So I'm not sure about all this... :)
  • Uninitialized Variable and qDebug Statement

    Unsolved
    4
    0 Votes
    4 Posts
    278 Views
    J
    Thanks, appreciate it. Makes sense now
  • Loop images within one QDialog, closing all Windows and open new Window with button

    Unsolved
    8
    0 Votes
    8 Posts
    366 Views
    J
    @Pl45m4 thanks! I was pretty dumb to not consider this natural variant
  • how to create 3d surface graphics in qt c++

    Unsolved
    4
    0 Votes
    4 Posts
    291 Views
    A
    I think it would be the best fit for your use case (from among the options available in the Qt Framework)
  • how to include Lib without library identification in qmake

    Solved
    4
    0 Votes
    4 Posts
    195 Views
    B
    @ChrisW67 I have found a way to solve the SYSTEMTIME error by adding #include <Windows.h>