Commit ea9ddcff authored by Claudio Valerio's avatar Claudio Valerio

the initial vertical position is adapted to match the middle of the screen

parent 0428f938
...@@ -93,23 +93,28 @@ UBStylusPalette::UBStylusPalette(QWidget *parent, Qt::Orientation orient) ...@@ -93,23 +93,28 @@ UBStylusPalette::UBStylusPalette(QWidget *parent, Qt::Orientation orient)
void UBStylusPalette::initPosition() void UBStylusPalette::initPosition()
{ {
if(!UBSettings::settings()->appToolBarOrientationVertical->get().toBool())
{
QWidget* pParentW = parentWidget(); QWidget* pParentW = parentWidget();
if(NULL != pParentW) if(!pParentW) return ;
{
mCustomPosition = true; mCustomPosition = true;
QPoint pos; QPoint pos;
int parentWidth = pParentW->width(); int parentWidth = pParentW->width();
int parentHeight = pParentW->height(); int parentHeight = pParentW->height();
int posX = (parentWidth / 2) - (width() / 2);
int posY = parentHeight - border() - height();
if(UBSettings::settings()->appToolBarOrientationVertical->get().toBool()){
int posX = border();
int posY = (parentHeight / 2) - (height() / 2);
pos.setX(posX); pos.setX(posX);
pos.setY(posY); pos.setY(posY);
moveInsideParent(pos);
} }
else {
int posX = (parentWidth / 2) - (width() / 2);
int posY = parentHeight - border() - height();
pos.setX(posX);
pos.setY(posY);
} }
moveInsideParent(pos);
} }
UBStylusPalette::~UBStylusPalette() UBStylusPalette::~UBStylusPalette()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment