Why toolbar in docked window is not visible properly
-
I am trying to create a docked widget. In the docked widget, when I try to create a toolbar, tool bar is not visible properly -

As you can see in the highlighted portion, the tool-bar is overlapping the chart and is also very small. What could be reason?
Here is how I am creating the docked window and the toolbar -
// Code to create docked window from Mainwindow
QDockWidget *dock = new QDockWidget(tr("Histogram"), this);
dock->setAllowedAreas(Qt::BottomDockWidgetArea);
histogramWin = new histogram(dock);
addDockWidget(Qt::BottomDockWidgetArea, dock);
dock->setMinimumSize(this->size().width(), this->size().height()/2);histogramWin->showHistogram(); //populates histogram widget data// declaration of class histogram
class histogram : public QChartView// constructor if histogram
histogram::histogram(QDockWidget* dockWidget)
: chartView (new QChartView(dockWidget))
{
dockWidgetPtr = dockWidget;
createToolbar();
chart = chartView->chart();
dockWidget->setWidget(chartView);
series = new QStackedBarSeries();
}//this creates toolbar
void histogram::createToolbar()
{
QToolBar *toolBar = new QToolBar(chartView);
QLabel *startTimelabel = new QLabel("Histo Start Time");
toolBar->addWidget(startTimelabel);
toolBar->show();
toolBar->setAllowedAreas(Qt::TopToolBarArea);expandBarAct = new QAction( tr("Expand"), this); expandBarAct->setStatusTip(tr("Expand the selected bar")); expandBarAct->setToolTip(tr("Expand the selected bar")); connect(expandBarAct, &QAction::triggered, this, &histogram::expandBar); toolBar->addAction(expandBarAct);}
Any suggestions to fix the toolbar visibility issue?
Thanks.
-
I am trying to create a docked widget. In the docked widget, when I try to create a toolbar, tool bar is not visible properly -

As you can see in the highlighted portion, the tool-bar is overlapping the chart and is also very small. What could be reason?
Here is how I am creating the docked window and the toolbar -
// Code to create docked window from Mainwindow
QDockWidget *dock = new QDockWidget(tr("Histogram"), this);
dock->setAllowedAreas(Qt::BottomDockWidgetArea);
histogramWin = new histogram(dock);
addDockWidget(Qt::BottomDockWidgetArea, dock);
dock->setMinimumSize(this->size().width(), this->size().height()/2);histogramWin->showHistogram(); //populates histogram widget data// declaration of class histogram
class histogram : public QChartView// constructor if histogram
histogram::histogram(QDockWidget* dockWidget)
: chartView (new QChartView(dockWidget))
{
dockWidgetPtr = dockWidget;
createToolbar();
chart = chartView->chart();
dockWidget->setWidget(chartView);
series = new QStackedBarSeries();
}//this creates toolbar
void histogram::createToolbar()
{
QToolBar *toolBar = new QToolBar(chartView);
QLabel *startTimelabel = new QLabel("Histo Start Time");
toolBar->addWidget(startTimelabel);
toolBar->show();
toolBar->setAllowedAreas(Qt::TopToolBarArea);expandBarAct = new QAction( tr("Expand"), this); expandBarAct->setStatusTip(tr("Expand the selected bar")); expandBarAct->setToolTip(tr("Expand the selected bar")); connect(expandBarAct, &QAction::triggered, this, &histogram::expandBar); toolBar->addAction(expandBarAct);}
Any suggestions to fix the toolbar visibility issue?
Thanks.