Results 1 to 1 of 1

Thread: QwtPlotCanvas Transparent

  1. #1
    Join Date
    Jun 2025
    Posts
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default QwtPlotCanvas Transparent

    Hi All!

    I use linux, Qt creator, Qt and qwt lib. I've created 2 QwtPlot objects - plot_1 and plot_3. plot_3 is transparent, because I'm going to add curves on the plot_1 and I have to watch them under the plot_3.

    mainwindow.cpp

    Qt Code:
    1. #include "mainwindow.h"
    2. #include "ui_mainwindow.h"
    3.  
    4. MainWindow:: MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
    5. {
    6. ui->setupUi(this)
    7.  
    8. c1 = new QwtPlotCanvas();
    9. c1->setFrameStyle(QFrame::NoFrame);
    10. c1->setPaintAttribute(QwtPlotCanvas::BackingStore, false);
    11. ui->plot_3->setAutoFillBackground(false);
    12. ui->plot_3->setCanvas(c1);
    13. ui->plot_3->setCanvasBackground(QColor(255,0,0,10));
    14.  
    15. }
    To copy to clipboard, switch view to plain text mode 
    mainwindow.h
    Qt Code:
    1. #include <QMainWindow>
    2. #include "qwt_plot_canvas.h"
    3. class MainWindow: public QMainWindow
    4. { Q_OBJECT
    5. public:
    6. MainWindow(QWidget *parent = nullptr);
    7. ~MainWindow();
    8. private:
    9. Ui::MainWindow *ui;
    10. };
    To copy to clipboard, switch view to plain text mode 

    This is a simple code and it is working, the plot_3 is transtarent and I can see the plot_1 under the plot_3.
    But there is a very strange effect. I move the main window and transparent of the plot_3 is missed. After several mooving the transparent is dessapeared and the color becomes solid.
    Also, something happens with plot_3 and transparent when I change the size of the main window.
    Could you please help and explain mee why does this effect happen and how to avoid it?
    Last edited by d_stranz; Yesterday at 17:33. Reason: missing [code] tags

Similar Threads

  1. QwtPlotCanvas Class
    By CodeFreak in forum Newbie
    Replies: 0
    Last Post: 4th January 2018, 18:58
  2. problem with QwtPlotCanvas::paintEvent
    By MickyJhon in forum Qwt
    Replies: 2
    Last Post: 31st January 2014, 09:38
  3. Replies: 3
    Last Post: 28th January 2010, 09:15
  4. Replies: 3
    Last Post: 25th August 2009, 15:24
  5. Transparent background on QLabel on transparent QWidget
    By codeslicer in forum Qt Programming
    Replies: 1
    Last Post: 13th February 2008, 02:10

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.