Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. When the dialog pops up, the chart series is drawn over the dialog.
Forum Updated to NodeBB v4.3 + New Features

When the dialog pops up, the chart series is drawn over the dialog.

Scheduled Pinned Locked Moved Unsolved General and Desktop
16 Posts 2 Posters 1.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I IknowQT

    ea09c8e2-38f2-4575-8e02-2b214cc66caa-image.png

    c56cf9b2-ddf5-42cf-8408-915766417b29-image.png

    wSetupBaseBckg::wSetupBaseBckg(wSpectrum_Settings* pSetUpWidget, QWidget* parent)
    	: QDialog(parent), m_bClose(false),
    	m_pWidget(pSetUpWidget)
    {
    	ui.setupUi(this);
    	this->setWindowFlags(Qt::FramelessWindowHint);
    
    	this->setStyleSheet("QDialog{background-color: rgba(255, 255, 255, 100);}");
    
    	pSetUpWidget->setFixedSize(parent->size().width() * 75 / 100, parent->size().height() * 85 / 100);
    	this->ui.verticalLayout->addWidget(pSetUpWidget);
    
    	this->connect(pSetUpWidget, SIGNAL(UserDefineWidgetClose()), this, SLOT(WidgetClose()));
    	this->connect(pSetUpWidget, SIGNAL(UserDefineWidgetApply()), this, SLOT(WidgetClose()));
    
    	pSetUpWidget->Initailize();
    }
    
    void wSpectrum::InitTableWidget()
    {
    	m_pChart->setTitle(m_pSpectrumInfo->strMethodName);
    
    	QList<QPair<QString, QList<qreal>>> lstTemp;
    	QPair<QString, QList<qreal>> pairTemp;
    
    	pairTemp.first = "WaveLength";
    	pairTemp.second = m_pSpectrumInfo->GetWaves();
    	lstTemp.append(pairTemp);
    
    	if (!m_pDataModel)
    	{
    		m_pDataModel = new usrTableModel(lstTemp);
    		this->ui.tableWidget->setModel(m_pDataModel);
    	}
    	else
    	{
    		m_pDataModel->InitData();
    		m_pDataModel->SetLowData(lstTemp);
    		this->ui.tableWidget->reset();
    	}
    	//this->ui.tableWidget->setModel(m_pDataModel);
    
    	/*if (!m_pHeaderModel)
    		m_pHeaderModel = new usrTableModel(lstTemp);
    	else
    	{
    		m_pHeaderModel->InitData();
    		m_pHeaderModel->SetLowData(lstTemp);
    	}
    	this->ui.tableWidget->InitFrozenTableview(m_pHeaderModel);*/
    
    	// [축 설정]
    	auto xAixs = std::minmax_element(lstTemp[0].second.begin(), lstTemp[0].second.end());
    	m_pChart->axisX()->setRange(*xAixs.first, *xAixs.second);
    	m_pChart->axisY()->setRange(0, 5);	
    
    	QValueAxis* axisx = qobject_cast<QValueAxis*>(m_pChart->axes(Qt::Horizontal).first());
    	axisx->setTickCount(5);
    
    	this->ui.tableWidget->update();
    }
    

    After drawing the chart, a dialog box pops up.
    When popping up, the chart is drawn over the dialog.
    I made the dialog background transparent, is that the cause? Other controls are well hidden.
    However, only the line series of the chart is drawn.

    I found one more problem. Tablemodel's subclassing data and headData's events are not received.
    So the data is not visible on the UI.

    QXYModelMapperPrivate::initializeXYFromModel "Invalid Y coordinate index in model mapper."
    A message appears.

    There seems to be a problem initializing the chart.
    There doesn't seem to be any problem with the code.

    I Offline
    I Offline
    IknowQT
    wrote on last edited by IknowQT
    #2

    @IknowQT

    is this a bug? please answer

    I have discovered one thing.
    I am using this option( pSeries->setUseOpenGL(true); ) to improve the speed of the line series.
    If I comment this out, it works fine.

    1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #3

      Without a minimal, compilable example we can't say if it's a bug in Qt or on your side. I would guess it's on your side.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      I 2 Replies Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        Without a minimal, compilable example we can't say if it's a bug in Qt or on your side. I would guess it's on your side.

        I Offline
        I Offline
        IknowQT
        wrote on last edited by
        #4

        @Christian-Ehrlicher

        void wSpectrum::AddChartSeries(bool isData, usrTableModel* pModel)
        {
        	QLineSeries* pSeries = new QLineSeries(m_pChart);
        	//pSeries->setUseOpenGL(true);							// 속도 향상
        
        	QVXYModelMapper* mapper = new QVXYModelMapper(this);
        	mapper->setXColumn(0);
        	mapper->setYColumn(pModel->GetColCount()-1);
        	
        	if(isData)
        		mapper->setSeries(pSeries);
        
        	mapper->setModel(pModel);
        
        	m_pChart->addSeries(pSeries); 
        	m_pChart->createDefaultAxes();
        
        	// [축 재설정] 
        	{
        		QValueAxis* axisx = qobject_cast<QValueAxis*>(m_pChart->axes(Qt::Horizontal).first());
        		axisx->setTickCount(5);
        
        		m_pChart->axisX()->setTitleFont(cGlobalParam::gGetChartAxis(true));
        		m_pChart->axisX()->setTitleText("Wave Length");
        		m_pChart->axisX()->setTitleBrush(QBrush(QColor(76, 127, 185)));		
        
        		m_pChart->axisY()->setTitleFont(cGlobalParam::gGetChartAxis(true));
        		m_pChart->axisY()->setTitleText("Absorbance.");
        		m_pChart->axisY()->setTitleBrush(QBrush(QColor(76, 127, 185)));
        	}
        
        	// [행의 마지막 위치로 이동]
        	QModelIndex index = pModel->index(0, pModel->GetColCount()-1, QModelIndex());
        	this->ui.tableWidget->scrollTo(index, QAbstractItemView::PositionAtTop);
        }
        
        void wSpectrum::BtnMeasure()
        {
        	QPair<QString, QList<qreal>> pairTemp2;
        
            pairTemp2.first = QString("D_%1").arg(m_pDataModel->GetInputData().count());
        	for (int i = 0; i < this->m_pSpectrumInfo->GetDataCount()+1; i++)
        	{        
        		qreal qRan1 = QRandomGenerator::global()->bounded(0, 10);
        		qreal qRan2 = QRandomGenerator::global()->generateDouble();
        		pairTemp2.second.append(qRan1 + qRan2);
        	}
        	m_pDataModel->AppendData(pairTemp2);
        
            AddChartSeries(true, m_pDataModel);	
        	//this->update();
        }
        

        I am connecting tables and charts with Abstractmodel. It draws a series whenever data comes in, but the setUseOpenGL option seems to be the cause. Please understand that we cannot upload the full source.

        1 Reply Last reply
        0
        • Christian EhrlicherC Christian Ehrlicher

          Without a minimal, compilable example we can't say if it's a bug in Qt or on your side. I would guess it's on your side.

          I Offline
          I Offline
          IknowQT
          wrote on last edited by
          #5

          @Christian-Ehrlicher

          pSeries->setUseOpenGL(true); If I disable the function, it works fine.
          The problem with this is that even if you delete all the series in the chart, it remains on the screen. But when I switch to another screen with the mouse, it is cleared.

          This is a bug.

          1 Reply Last reply
          0
          • Christian EhrlicherC Online
            Christian EhrlicherC Online
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #6

            If you can't provide a minimal, compilable example we can't help here. I doubt it's a bug in Qt but on your side. If you think it's a bug, write a bug report but even there you need a minimal, compilable examle to get your problem fixed...

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            I 1 Reply Last reply
            0
            • Christian EhrlicherC Christian Ehrlicher

              If you can't provide a minimal, compilable example we can't help here. I doubt it's a bug in Qt but on your side. If you think it's a bug, write a bug report but even there you need a minimal, compilable examle to get your problem fixed...

              I Offline
              I Offline
              IknowQT
              wrote on last edited by IknowQT
              #7

              @Christian-Ehrlicher

              93a99d2a-0cf5-4047-b21a-ed9482b8bf86-image.png

              https://github.com/HaonPAPA/MyRepository/blob/main/linechart.7z

              I have created an example. A dialog box pops up after creating a series by clicking the Add series button.
              A blue widget is floating in the dialog. It is drawn over the widget.

              1 Reply Last reply
              1
              • Christian EhrlicherC Online
                Christian EhrlicherC Online
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #8

                It's the combination of Qt::FramelessWindowHint and OpenGl. You should create a bug report with your testcase.

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                I 1 Reply Last reply
                1
                • Christian EhrlicherC Christian Ehrlicher

                  It's the combination of Qt::FramelessWindowHint and OpenGl. You should create a bug report with your testcase.

                  I Offline
                  I Offline
                  IknowQT
                  wrote on last edited by IknowQT
                  #9

                  @Christian-Ehrlicher

                  Are you saying it's a bug?

                  1 Reply Last reply
                  0
                  • Christian EhrlicherC Online
                    Christian EhrlicherC Online
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    Yes - as I told you create a bug report, but why do you need such a dialog on top?

                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                    Visit the Qt Academy at https://academy.qt.io/catalog

                    I 1 Reply Last reply
                    0
                    • Christian EhrlicherC Christian Ehrlicher

                      Yes - as I told you create a bug report, but why do you need such a dialog on top?

                      I Offline
                      I Offline
                      IknowQT
                      wrote on last edited by
                      #11

                      @Christian-Ehrlicher

                      I am trying to open an option window. However, as a form of style, I tried to lower the alpha value around it to draw more attention to the options window.

                      The method I have implemented may not be the normal method.
                      If there is a better way please suggest

                      1 Reply Last reply
                      0
                      • Christian EhrlicherC Online
                        Christian EhrlicherC Online
                        Christian Ehrlicher
                        Lifetime Qt Champion
                        wrote on last edited by
                        #12

                        What's wrong with a simple QDialog?

                        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                        Visit the Qt Academy at https://academy.qt.io/catalog

                        I 1 Reply Last reply
                        0
                        • Christian EhrlicherC Christian Ehrlicher

                          What's wrong with a simple QDialog?

                          I Offline
                          I Offline
                          IknowQT
                          wrote on last edited by
                          #13

                          @Christian-Ehrlicher

                          60378480-35ba-4492-84c3-2ac9a7a32b4b-image.png
                          This is the UI I wanted.

                          1 Reply Last reply
                          0
                          • Christian EhrlicherC Online
                            Christian EhrlicherC Online
                            Christian Ehrlicher
                            Lifetime Qt Champion
                            wrote on last edited by
                            #14

                            This is a simple QMessageBox. Why so much work? Why must it be frameless?

                            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                            Visit the Qt Academy at https://academy.qt.io/catalog

                            I 1 Reply Last reply
                            0
                            • Christian EhrlicherC Christian Ehrlicher

                              This is a simple QMessageBox. Why so much work? Why must it be frameless?

                              I Offline
                              I Offline
                              IknowQT
                              wrote on last edited by
                              #15

                              @Christian-Ehrlicher

                              The program we are developing is user UI-oriented, so we have to pay a lot of attention to the little things.

                              answer my question
                              What I want is to blur the background behind it. It could be done very simply in C# too.
                              Is there a better way than the way I did?

                              1 Reply Last reply
                              0
                              • Christian EhrlicherC Online
                                Christian EhrlicherC Online
                                Christian Ehrlicher
                                Lifetime Qt Champion
                                wrote on last edited by
                                #16

                                I don't know - if you've a commercial license then ask TQtC to fix it. Otherwise find a workaround.

                                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                                Visit the Qt Academy at https://academy.qt.io/catalog

                                1 Reply Last reply
                                0

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved