A solution would be doing something like this: m_chart->legend()->setAlignment(Qt::AlignTop);
QApplication::processEvents(); m_chart->legend()->setY(m_chart->plotArea().height() - m_chartView->height() ); Which feels like a big hack. Is there a better way? There must be. On 11 April 2018 at 10:12, Christopher Probst <christop.pro...@gmail.com> wrote: > Ok there seems to be a solution to this by Using > > > m_chart->legend()->moveBy > > > I will keep you posted. > > > On 11 April 2018 at 10:05, Christopher Probst <christop.pro...@gmail.com> > wrote: > >> I have noticed that! Clearly they thought of it! I tried grabbing the y >> coordinate of the legend and changing it. That also does not work! It would >> be nice to have a solution to this. >> >> On 11 April 2018 at 10:03, Mike Chinander <chinan...@gmail.com> wrote: >> >>> Not sure of a solution to this, but noticed that unlike other uses of >>> Qt::Alignment flags, the QLegend docs say, "If you set more than one flag, >>> the result is undefined." >>> >>> https://doc.qt.io/qt-5.10/qlegend.html#alignment-prop >>> >>> On Wed, Apr 11, 2018 at 8:51 AM, Christopher Probst < >>> christop.pro...@gmail.com> wrote: >>> >>>> Hi, >>>> >>>> I would like to place the legend of chart that uses Qt charts at the >>>> top right of the view. I would have expected something like this to work: >>>> >>>> m_chart->legend()->setAlignment(Qt::AlignTop| Qt::AlignRight) >>>> >>>> >>>> Unfortunately it does not! Is there a direct way to make the legends >>>> (right or left) be top aligned rather then middle.? >>>> >>>> >>>> Thanks, >>>> >>>> Christopher >>>> >>>> >>>> >>>> _______________________________________________ >>>> Interest mailing list >>>> Interest@qt-project.org >>>> http://lists.qt-project.org/mailman/listinfo/interest >>>> >>>> >>> >>> _______________________________________________ >>> Interest mailing list >>> Interest@qt-project.org >>> http://lists.qt-project.org/mailman/listinfo/interest >>> >>> >> >
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest