Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.5k Posts
  • Triggering Windows 7 builtin popup keyboard from QT application.

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • QtTreePropertyBrowser/QTreeWidget crash

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • QtMultimedia and QAbstractVideoBuffer

    2
    0 Votes
    2 Posts
    4k Views
    M
    Hi! I'm having the same problem: trying to figure out how to use the QtMultimedia module for playing video files. Maybe we can share our efforts and get some progress together. I'm using libvlc in order to decode video files: each time a new frame is ready, libvlc stores the RGB32 bytes representation in a preallocated buffer in memory, I'll call a pointer to this buffer "backendBuffer". I thought that I could just subclass QAbstractVideoBuffer so as to have a wrapper for the backendBuffer and return it with the map funcion: This is the header: @ class VideoBuffer : public QAbstractVideoBuffer { public: VideoBuffer(HandleType type = NoHandle); virtual ~VideoBuffer(); uchar* map(MapMode mode, int* numBytes, int* bytesPerLine); MapMode mapMode() const; void unmap(); void setBackendBuffer(uchar* buffer, int frameWidth, int frameHeight); int frameWidth() { return _frameWidth; }; int frameHeight() { return _frameHeight; }; private: uchar* _backendBuffer; int _frameWidth; int _frameHeight; }; @ and this is the definition: @ VideoBuffer::VideoBuffer(HandleType type) : QAbstractVideoBuffer(type) { } VideoBuffer::~VideoBuffer() { } uchar* VideoBuffer::map(MapMode mode, int* numBytes, int* bytesPerLine) { // I just ignore the MapMode if (numBytes != NULL) *numBytes = _frameWidth * _frameHeight * 4; if (bytesPerLine != NULL) *bytesPerLine = _frameWidth * 4; return _backendBuffer; // should I return a copy of the backendBuffer? } QAbstractVideoBuffer::MapMode VideoBuffer::mapMode() const { return ReadOnly; } void VideoBuffer::unmap() { // I assume there's nothing to do if I don't return a copy of the bakendBuffer } void VideoBuffer::setBackendBuffer(uchar* buffer, int frameWidth, int frameHeight) { _backendBuffer = buffer; _frameWidth = frameWidth; _frameHeight = frameHeight; } @ The idea is to call VideoBuffer::setBackendBuffer(...) passing in the preallocated memory buffer which is filled in by libvlc, for instance: @ _videoBuffer = new VideoBuffer; _videoBuffer->setBackendBuffer(_vlcBufferDataPtr, _frameWidth, _frameHeight); @ Now, each time a new frame is ready to be displayed (its RGB32 representation has been written in the backendBuffer), libvlc calls the following method with a pointer to the VideoBuffer that wraps the backendBuffer. I create a QVideoFrame and then call QAbstractVideoSurface::present(...). QAbstractVideoSurface code is exactly the one you can find in the Video Widget Example. In the following code, videoSurface is a pointer to a QAbstractVideoSurface object. @ void Controller::bufferReady(VideoBuffer* videoBuffer) { mutex.lock(); QSize frameSize( videoBuffer->frameWidth(), videoBuffer->frameHeight() ); QVideoFrame videoFrame( videoBuffer, frameSize, QVideoFrame::Format_RGB32 ); if (!videoFrame.isValid()) return; // false QVideoSurfaceFormat currentSurfaceFormat = videoSurface->surfaceFormat(); if (videoFrame.pixelFormat() != currentSurfaceFormat.pixelFormat() || videoFrame.size() != currentSurfaceFormat.frameSize()) { QVideoSurfaceFormat format(videoFrame.size(), videoFrame.pixelFormat()); if (!videoSurface->start(format)) return; // false; } if (!videoSurface->present(videoFrame)) { videoSurface->stop(); return; // false; } else { return; // true; } mutex.unlock(); } @ However, this code crashes... Any idea why? Thanks for any help!
  • QComboBox item height[Solved]

    7
    0 Votes
    7 Posts
    16k Views
    R
    Hi all, I am also trying to access ::item of the ItemView of the QComboBox but QComboBox QAbstractItemView::item does not seems to work. I am using Qt 4.7.1 ... does someone successfully used ::item in this case ? Thanks in advance.
  • QTabBar background and QTabWidgets corner widget

    1
    0 Votes
    1 Posts
    3k Views
    No one has replied
  • How to lock/ unlock Windows PC using Qt pro-gramatically?

    9
    0 Votes
    9 Posts
    6k Views
    P
    Thanks... I will try that soon.
  • 0 Votes
    3 Posts
    10k Views
    B
    Ohh my god... you rock :D It worked! :D I think I need to read some Qt tutorials or get a Qt book because I don't know a lot of basic stuff. I didn't know about viewport for example :P Thanks again my friend! Cheers!
  • [Solved] How can I uncheck the qcheckbox?

    4
    0 Votes
    4 Posts
    5k Views
    A
    thank you both
  • Hover Problem with QToolBar/QAction

    4
    0 Votes
    4 Posts
    4k Views
    U
    PS - almost forgot to give the code. It's here: "ZIP FILE":http://www.bigangrydog.com/scratch/file_selector.zip
  • How to create a Dll in Qt

    3
    0 Votes
    3 Posts
    13k Views
    L
    Hi Monalisa, In general you have to add the following line to the .pro file of your Qt project if want to to create a library: @TEMPLATE = lib@ But the easiest way it to follow Gerolf's advice and Qt Creator will add this line to the .pro file automatically. Best regards, Leon
  • 'index out of range' When Using QList

    20
    0 Votes
    20 Posts
    28k Views
    A
    [quote author="sammarks" date="1302724779"] [quote author="Andre" date="1302680125"]So, that means that you are still trying to read values that are not actually in your list, only now you don't notice because QList returns a default constructed value for you. If you do that by design, then fine, but that does not seem to be the case. I suggest you try to track the actual cause of the problem, instead of just making sure it doesn't trigger a crash. [/quote] If I remember correctly, the actual cause of the problem wasn't because something was out of range, as it returned a legitimate value when the .value() was called, but the simple fact that I was using .at() didn't build correctly on the Linux platform for some reason.[/quote] QList::at() works just as well on linux (and all other supported platforms) as it does on Mac. Like I said (and the documentation for QList says; don't take my word for it): QList returns a default constructed value for you if the index you pass to it is out of bounds. So, my bet is that your code is actually trying to access an out of bounds value, and that Qt is behaving just the way it should.
  • [SOLVED]Is there a way to unset Qt::FramelessWindowHint?

    7
    0 Votes
    7 Posts
    7k Views
    G
    Hi vonb, this is also stated in the "docs":http://doc.qt.nokia.com/4.7/qwidget.html#windowFlags-prop bq. Note: This function calls setParent() when changing the flags for a window, causing the widget to be hidden. You must call show() to make the widget visible again.. so changing the windowFlags means, you have to call show again :-(
  • Context Menus

    4
    0 Votes
    4 Posts
    6k Views
    G
    If you look at the docs, the signal has this signature: @ void customContextMenuRequested ( const QPoint & pos ); @ if you use the correct signatrure, it would work: @ void VCMainWindow::CreateNewDataTab( ) { /BEGIN FUNCTION CREATENEWDATATAB()/ VCWIDGETPTR NewDataTab = NULL; NewDataTab = new VCWIDGET; //Creates an instance of a new data tab NewDataTab->setContextMenuPolicy( Qt::CustomContextMenu ); connect( NewDataTab, SIGNAL( customContextMenuRequested( const QPoint & ) ), this, SLOT( ShowTabContextMenu( ) ) ); VCTabBar->addTab( new VCMPDataTabLayout( this ), "New Tab"); } /CLOSE FUNCTION CREATENEWDATATAB()/ @
  • How to drag&drop between QFrame and QGraphicsView

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • [Solved] Qt Module for PDF files?

    7
    0 Votes
    7 Posts
    5k Views
    X
    Thank you for the warning. I'm a 100% GPL developer... so there's no issues about it for me :)
  • Best clickable widget for color swatch?

    6
    0 Votes
    6 Posts
    6k Views
    S
    I am going to build my own. Just want to know I am not reinventing the wheel. :) Thanks.
  • Fit Page under QTabWidget

    8
    0 Votes
    8 Posts
    3k Views
    R
    Please help, I'm confused
  • Qt and GE Plugin 6.0 Integration

    3
    0 Votes
    3 Posts
    2k Views
    C
    Sorry, Google Earth.
  • Cannot mix incompatible Qt libraries Error

    4
    0 Votes
    4 Posts
    4k Views
    G
    Hi Roy_CT, I checked the Qt source code. It seams you are using QtCore and QtGui from different versions. This could be different compilers, different version (e.g. 4.7.0 and 4.7.2)
  • QStatusbar problem with insertWidget

    17
    0 Votes
    17 Posts
    8k Views
    A
    Are you using QtCreator? If so, run your program by pressing F5 (or pressing the green arrow with the little bug on it on the bottom left of your screen).