Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.8k Topics 458.5k Posts
  • Reporting inappropriate content on the forums

    Pinned Locked spam
    29
    4 Votes
    29 Posts
    36k Views
    A
    Thank you for the report. I have banned the user, which got rid of the spam posting. Not a loss, as this user did not post any other content on the site. Just deleting this one posting was not possible. Thanks for reporting this.
  • Using GStreamer Within Qt (QGroundControl-Like Architecture)

    Unsolved
    13
    0 Votes
    13 Posts
    102 Views
    serkan_trS
    @hoandepchai and @SGaist As a temporary solution, I am receiving the video using appsink, performing the required conversions to pass it to the QML side, and creating a QImage. I then send this QImage to the QML layer. The code currently works, and I can receive everything sent via GStreamer without issues. However, I am not sure how correct this approach is from an architectural and performance perspective. void VideoReceiver::process(GstSample *sample) { GstBuffer *buffer = gst_sample_get_buffer(sample); GstCaps *caps = gst_sample_get_caps(sample); GstMapInfo map; gst_buffer_map(buffer, &map, GST_MAP_READ); GstVideoInfo info; gst_video_info_from_caps(&info, caps); QImage img( map.data, info.width, info.height, QImage::Format_RGB888 ); m_lastFrameTime = std::chrono::steady_clock::now(); m_frameCounter++; if(!hasVideo()) { m_hasVideo = true; hasVideoChanged(); } m_frame = img.copy(); provider->updateImage(m_frame); emit frameChanged(); gst_buffer_unmap(buffer, &map); } Image { anchors.fill: parent fillMode: Image.PreserveAspectFit visible: videoReceiver && videoReceiver.hasVideo source: videoReceiver ? videoReceiver.frameUrl : "" cache: false }
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    15 Views
    No one has replied
  • LNK2019: unresolved external symbol and LNK1120: 1 unresolved externals

    Unsolved
    2
    0 Votes
    2 Posts
    36 Views
    aha_1980A
    Hi @hoandepchai, well the linker is searching for a function (constructor) GPSDriverUBX::GPSDriverUBX but cannot find it (or maybe it cannot find the correct overload in case there are multiple definitions of this functions. It also says, this function is called from the function void GPSProvider::run(void). So what I would do: Completely clean the build environment and rebuild everything Make sure you link the file that contains GPSDriverUBX::GPSDriverUBX (in case that's an external library, make sure you link the library) In case that does not help, have a look at the linker command line in the build output if you can spot something unusual. Regards
  • How to reduce padding on QTableView cells?

    Unsolved
    4
    0 Votes
    4 Posts
    72 Views
    S
    As suggested by @Sgaist, I've implemented a "simple" demonstration of my QTableView below using a QItemDelegate to render the cell contents. I selected this delegate type instead of QStyledItemDelegate to have access to functions like drawDisplay() and drawFocus() instead of using painter->save() and painter->restore(). I moved the font settings from QTableModel::data() to QItemDelegate::paint() just to ensure the delegate was working. The code produces a QTableView with the table cells more or less adjusted to their contents. The first column with the sequence names is correct, but the subsequent columns for the bases are a bit wide. Apparently, there's a minimum width for columns, but I don't know where it's defined! How do I change that? Is it through the QStyleOptionViewItem class? #include <QAbstractTableModel> #include <QApplication> #include <QMainWindow> #include <QTableView> #include <QHeaderView> #include <QItemDelegate> #include <QList> #include <QPainter> #include <QFont> class BaseDelegate : public QItemDelegate { Q_OBJECT public: explicit BaseDelegate(QObject *parent = nullptr) {} void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { // if ( index.column() > 0 ) { QString text = index.data(Qt::DisplayRole).toString(); QStyleOptionViewItem myOption = option; QFont font("Courier New"); font.setPointSize( 14 ); myOption.font = font; myOption.displayAlignment = Qt::AlignCenter | Qt::AlignVCenter; drawDisplay( painter, myOption, myOption.rect, text ); drawFocus( painter, myOption, myOption.rect ); } else { QItemDelegate::paint(painter, option, index); } } }; class TableModel : public QAbstractTableModel { Q_OBJECT private: int rows {10}; int columns {10}; char seqs[100]; QList<QString> names; public: explicit TableModel(QObject *parent = nullptr) { names.push_back("Species 01"); names.push_back("Species 02"); names.push_back("Species 03"); names.push_back("Species 04"); names.push_back("Species 05"); names.push_back("Species 06"); names.push_back("Species 07"); names.push_back("Species 08"); names.push_back("Species 09"); names.push_back("Species 10"); std::string d ="AGTATAATTATTCGGGCTGAGTTAGGTCAGCCAGGTAGATTCATTGGAGACGATCAGATTTATAATGTAGTTGTTACGGCGCATGCTTTTGTAATAATTT"; std::copy(std::begin(d), std::begin(d) + sizeof(seqs), std::begin(seqs)); } int rowCount(const QModelIndex &parent = QModelIndex()) const override { return rows; } int columnCount(const QModelIndex &parent = QModelIndex()) const override { return columns; } QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override { switch( role ) { case Qt::DisplayRole: if( index.column() == 0 ) { return QString("%1").arg( names[ index.row() ] ); } else { char base = seqs[index.row()*columns+index.column()]; return QString("%1").arg( base ); } break; default: return QVariant(); } } }; class MainWindow : public QMainWindow { Q_OBJECT private: QTableView * view; TableModel * model; public: MainWindow(QWidget *parent = nullptr) { setMinimumSize( 400, 300 ); model = new TableModel( this ); view = new QTableView( this ); view->setModel( model ); view->resizeColumnsToContents(); view->setItemDelegate( new BaseDelegate ); setCentralWidget( view ); } }; int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); } #include "main.moc"
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    16 Views
    No one has replied
  • qtmir Source code build

    Unsolved
    19
    0 Votes
    19 Posts
    605 Views
    Pl45m4P
    @Christian-Ehrlicher said in qtmir Source code build: From the same ip with the same browser? Nice try... Could be university/school public IP and same machine they share in PC pool / lab... But yeah... posting the same stuff without sharing information with each other is dumb :)
  • QTextBrowser link opens Notepad on Windows ???

    Unsolved
    2
    0 Votes
    2 Posts
    60 Views
    jeremy_kJ
    @BastienSante said in QTextBrowser link opens Notepad on Windows ???: Here is the method I wrote to handle clicking links : Unfortunately, based on the problem statement, this is code that isn't executed. That doesn't help clarify what is executed. My browser widget has setOpenExternalLinks(true). Moreover, Notepad is not set as the default application for Markdown, but manages to "steal" the file opening from my app ? What could be happening here ? Thanks for your answers ! QTextBrowser::openExternalLinks: Specifies whether QTextBrowser should automatically open links to external sources using QDesktopServices::openUrl() instead of emitting the anchorClicked signal. Links are considered external if their scheme is neither file or qrc. Did you intend to set openExternalLinks to false?
  • How to add a text label with every shape I draw using QPainter

    Unsolved
    13
    0 Votes
    13 Posts
    3k Views
    W
    Is there any question related to draw some text near the lines of your shape?
  • Bug with Pyside 6

    Solved
    6
    1 Votes
    6 Posts
    294 Views
    F
    From the Python point of view, the example does not work (wrong imports for QVector3D/Qt3Window). The revised example without cleanup import sys from PySide6.QtWidgets import QApplication, QMainWindow, QWidget from PySide6.QtGui import QVector3D from PySide6.Qt3DExtras import Qt3DExtras from PySide6.Qt3DCore import Qt3DCore class Simple3DWindow(Qt3DExtras.Qt3DWindow): def __init__(self, parent=None): super().__init__(parent) self._root_entity = Qt3DCore.QEntity() self.setRootEntity(self._root_entity) self.camera().lens().setPerspectiveProjection(45.0, 16.0/9.0, 0.1, 1000.0) self.camera().setPosition(QVector3D(0, 0, 20.0)) self.camera().setViewCenter(QVector3D(0, 0, 0)) def main(): app = QApplication(sys.argv) main_window = QMainWindow() main_window.setWindowTitle("Test QWindowContainer Segfault") main_window.resize(800, 600) display = Simple3DWindow() container = QWidget.createWindowContainer(display) # ← Problem here main_window.setCentralWidget(container) main_window.show() result = QApplication.exec() # QApplication will be automatically destroyed by PySide6 → SEGFAULT return result if __name__ == "__main__": sys.exit(main()) does not show any crashes. There are some situations though in PySide, where an explicit synchronous cleanup or shutdown of graphics resources is required. This is then best done in an overridden closeEvent() of the top level window. Also note that Qt3D is now deprecated.
  • Make an application follow the platform theme (Linux)

    Unsolved
    9
    0 Votes
    9 Posts
    267 Views
    I
    @BastienSante said in Make an application follow the platform theme (Linux): When setting QT_DEBUG_PLUGINS to 1 and launching the app from a terminal, the output shows the plugins are detected, however I don't see any one having to do with themes. Maybe this plugin does not work with Qt 6.10.1 ? Well that probably means that the plugins aren't there... post the output generated by it (ideally as a link to a pastebin or gist, the output is quite long usually) and I could tell you perhaps.
  • QSocketNotifier and libgpiod on Raspberry Pi

    Solved
    7
    0 Votes
    7 Posts
    178 Views
    SGaistS
    Excellent ! Thanks for the feedback ! Since you have it working now, please mark the thread as solved using the "Topic Tools" button or the three dotted menu beside the answer you deem correct so other forum users may know a solution has been found :-)
  • Text drop shadow inside a custom paint function of QStyledItemDelegate

    Unsolved
    4
    0 Votes
    4 Posts
    88 Views
    S
    I've found an answer using QGraphicsDropShadowEffect on Stack Overflow: You can use QGraphicsPixmapItem to apply the effect purely on a pixmap instead of a widget, and use QGraphicsScene to render back to a pixmap. Not sure how expensive that is, might make sense to also throw QPixmapCache into the mix. I wanted to post the Python code for the solution translated to my use case, but the forum thinks that's spam, so 🤷‍♂️.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    8 Views
    No one has replied
  • How to create a Single Application in Qt QuickWidget 6.9.1

    Solved
    2
    0 Votes
    2 Posts
    45 Views
    SGaistS
    Hi, Look for QtSingleApplication
  • Google OAuth 2 Login on Qt 6.9.1

    Unsolved
    5
    0 Votes
    5 Posts
    173 Views
    SGaistS
    @Blackzero usually, applications spin a local web server to get the answer of the authentication process and basically asks the user to close the web page.
  • Trouble trying to use ASAN

    Unsolved
    16
    1 Votes
    16 Posts
    290 Views
    KH-219DesignK
    Again, I'm unfamiliar with MSVC range of sanitizer possibilities, but... Is UBSan available? Using both ASan and UBSan (if possible) would (of course) cover more bugs than just one sanitizer in isolation. (There is also LeakSan). Example flags: -fsanitize=address,undefined,leak Many, many years ago I also used windows-specific tools (DCRT, debug C runtime; and something called gflags.exe), and those tools worked well on MSVC to detect out-of-bounds writes and other memory abuses/errors. I'm not sure what the current windows state-of-the-art memory tooling is named and what form it takes.
  • 0 Votes
    11 Posts
    2k Views
    O
    @grainyblob Might be a weird question but I am quite new to coding, in the image, how did you get those rounded corners while applying acrylic? because I though corners were limited to 8px on windows 11 due to dwm, but it seems you have gone over this limit, I'm asking because I want to make a program that is similar to macos tahoe 26 spotlight search but for windows 11 using this effect.
  • download 1GB file using QNetworkAccessManager, QN..Request, QN..Reply

    Unsolved
    3
    0 Votes
    3 Posts
    101 Views
    Christian EhrlicherC
    Also when downloading 1GB I would save it to a QFile as soon as some parts arrived - connect https://doc.qt.io/qt-6/qiodevice.html#readyRead and save the already downloaded parts.
  • Using QFileSystemModel, QTreeView, and QSortFilterProxyModel

    Solved
    30
    0 Votes
    30 Posts
    867 Views
    Z
    QLZTreeView - see above Header: class QLZTreeView : public QTreeView { Q_OBJECT public: explicit QLZTreeView(QWidget* parent = nullptr); ~QLZTreeView(); protected: void renameCurrentObject(QModelIndex coCurrentIndex); void deleteCurrentObject(QModelIndex coCurrentIndex); void closeEditor(QWidget* editor, QAbstractItemDelegate::EndEditHint hint) override; private slots: void customContextMenu(const QPoint& point); }; QSortFilterProxyModel - is standard Qt class QLZFileSystemModel - see above Header: class QLZFileSystemModel : public QFileSystemModel { Q_OBJECT public: explicit QLZFileSystemModel(QObject* parent = nullptr); ~QLZFileSystemModel(); protected: Qt::ItemFlags flags(const QModelIndex& index) const override; }; main.cpp - and that's all. int main(int argc, char *argv[]) { QApplication app(argc, argv); LZImageViewerTest window; window.show(); return app.exec(); }