Skip to content
  • Using GStreamer Within Qt (QGroundControl-Like Architecture)

    Unsolved General and Desktop
    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 }
  • 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
  • IconImage and ColorImage current state

    Unsolved QML and Qt Quick
    3
    0 Votes
    3 Posts
    545 Views
    E
    Any update on this? As of Qt 6.10, it seems there is no obvious or simple way to change an image's color. This is pretty limiting!
  • Restore TextInput after invalid input

    Unsolved QML and Qt Quick
    4
    0 Votes
    4 Posts
    66 Views
    jeremy_kJ
    @GrecKo said in Restore TextInput after invalid input: onEditingFinished: m.setData(m.index(index, 0), text) No need to call setData either in 6.9, you can do it with onEditingFinished: model.display = text. Indeed. Simplifying further: ListView { anchors.fill: parent model: m delegate: TextInput { text: display onEditingFinished: display = text } } bool setData(const QModelIndex &index, const QVariant &value, int role) override { auto updated = (role == Qt::ItemDataRole::DisplayRole) ? value.toString().toUpper() : value; if (role == Qt::ItemDataRole::DisplayRole && updated.toString().contains('!')) { return false; } return QStandardItemModel::setData(index, updated, role); }
  • 0 Votes
    1 Posts
    18 Views
    No one has replied
  • How to reduce padding on QTableView cells?

    Unsolved General and Desktop
    4
    0 Votes
    4 Posts
    70 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"
  • My terminal is currently displaying a blank screen,

    Moved Unsolved Qt Creator and other tools
    8
    0 Votes
    8 Posts
    482 Views
    cristian-adamC
    @873578156 I've fixed the bug yesterday and merged the fix today, check a Qt Creator 18.0.2 snapshot https://download.qt.io/snapshots/qtcreator/18.0/18.0.2/ tomorrow.
  • Launching Of My Qt Training Youtube Channel

    Moved Unsolved Announcements
    1
    0 Votes
    1 Posts
    56 Views
    No one has replied
  • Qt Multimedia sub-category positioning

    Solved Qt.io webservices qtforum categories qtmultimedia
    5
    3 Votes
    5 Posts
    728 Views
    SGaistS
    @Pl45m4 Looks like it and I don't think so. It should be better now.
  • 0 Votes
    2 Posts
    93 Views
    J
    Can you explain a bit more detailed what you mean with "combine multiple objects together"? Do you want the objects to be locked together but being able to rotate independently or something? If you simply want to disable collisions between objects you can use https://doc.qt.io/qt-6/qml-qtquick3d-physics-physicsnode.html#filterGroup-prop
  • 0 Votes
    2 Posts
    122 Views
    J
    Is this "Warning: Failed to load image: <path_to_ktx2>" the actual output or have you redacted the path?
  • qtmir Source code build

    Unsolved General and Desktop
    19
    0 Votes
    19 Posts
    604 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 General and Desktop
    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?
  • MediaPlayer does not receive stream metadata.

    Unsolved QML and Qt Quick mediaplayer bug
    8
    0 Votes
    8 Posts
    1k Views
    SGaistS
    @Niclas-Eisenhut hi and welcome to devnet, Can you also confirme this with the latest 6.10 release ?
  • How to use qmlpreview?

    Unsolved QML and Qt Quick qml qmlpreview
    10
    0 Votes
    10 Posts
    172 Views
    R
    @GrecKo Don't you handle key press signals from QML and invoke clearSingletons, clearComponentCache and loadFromModule in main.cpp? That was the impression I got from post #4 where you introduced the enable_qml_hotreload CMake function. Basically, I'm asking: how do you currently do a hot reload with a key press? Minimal working example or a bit more details would be useful since I'm a bit lost in the advice so far. I'm especially interested in your approach since you said that you maintain the same QML in production and for hot reloading: @GrecKo said in How to use qmlpreview?: ...but I believe using Loader is not the correct approach since that's different from the production code you want. In other words, you avoid the QML scaffolding needed for hot reloading (apart from catching the hot reload key press, I guess).
  • QT 5.15 egl_kms Layering with kmssink [panfrost]

    Unsolved Mobile and Embedded
    4
    0 Votes
    4 Posts
    1k Views
    K
    @raphael_openhd Hello! I'm installing QOpenHD on an RK3588 (Orange Pi 5+). Ubuntu jammi. Could you please tell me how to correct do this?
  • decline of Qtforums

    Unsolved The Lounge
    10
    3 Votes
    10 Posts
    1k Views
    Christian EhrlicherC
    See also https://data.stackexchange.com/stackoverflow/query/1926661#graph
  • macdeployqt again

    Unsolved Installation and Deployment
    5
    0 Votes
    5 Posts
    163 Views
    DuBuD
    @SGaist Yes, it said libwebpmux depends on libsharpyuv but it didn't try to copy that one over. I found out libwebpmux is a dependency of a freerdp3 we use. So it seems macdeployqt either wasn't made for 3rd party libraries or it fails to handle them. It looks like I need to handle those dependencies by myself somehow.
  • How to add a text label with every shape I draw using QPainter

    Unsolved General and Desktop
    13
    0 Votes
    13 Posts
    3k Views
    W
    Is there any question related to draw some text near the lines of your shape?
  • How to register a class in a .js file of QML using C++?

    Unsolved QML and Qt Quick
    4
    0 Votes
    4 Posts
    90 Views
    Y
    @Axel-Spoerl I found that the following code works: QQmlApplicationEngine engine; auto ctor = engine.evaluate(R"( (function() { this.name = "test" this.create = function(){ return "hello world!" } }) )"); engine.globalObject().setProperty("OaiClient", ctor); However, I don’t understand what the documentation means when it says that the globalobject properties should not be modified, and I’m unsure what the implications of doing so might be.