Tooltips, fixes

pull/440/head
Nelsson Huotari 7 years ago
parent 62066f01bd
commit d2cf764a46

@ -44,24 +44,30 @@ CSVWidget::BrushSizeControls::BrushSizeControls(const QString &title, QWidget *p
CSVWidget::TextureBrushWindow::TextureBrushWindow(QWidget *parent)
: QFrame(parent, Qt::Popup),
mBrushShape(0),
mBrushSize(0)
mBrushSize(0),
mBrushTexture("L0#0")
{
mBrushTextureLabel = "Brush: " + mBrushTexture;
mBrushTextureLabel = "Selected texture (id): " + mBrushTexture;
mSelectedBrush = new QLabel(QString::fromStdString(mBrushTextureLabel), this);
QVBoxLayout *layoutMain = new QVBoxLayout;
layoutMain->setSpacing(0);
layoutMain->setContentsMargins(4,0,4,4);
QHBoxLayout *layoutHorizontal = new QHBoxLayout;
layoutHorizontal->setContentsMargins (QMargins (0, 0, 0, 0));
layoutHorizontal->setSpacing(0);
layoutHorizontal->setContentsMargins (QMargins (0, 0, 0, 0));
configureButtonInitialSettings(mButtonPoint);
configureButtonInitialSettings(mButtonSquare);
configureButtonInitialSettings(mButtonCircle);
configureButtonInitialSettings(mButtonCustom);
mButtonPoint->setToolTip (toolTipPoint);
mButtonSquare->setToolTip (toolTipSquare);
mButtonCircle->setToolTip (toolTipCircle);
mButtonCustom->setToolTip (toolTipCustom);
QButtonGroup* brushButtonGroup = new QButtonGroup(this);
brushButtonGroup->addButton(mButtonPoint);
brushButtonGroup->addButton(mButtonSquare);
@ -70,10 +76,10 @@ CSVWidget::TextureBrushWindow::TextureBrushWindow(QWidget *parent)
brushButtonGroup->setExclusive(true);
layoutHorizontal->addWidget(mButtonPoint);
layoutHorizontal->addWidget(mButtonSquare);
layoutHorizontal->addWidget(mButtonCircle);
layoutHorizontal->addWidget(mButtonCustom);
layoutHorizontal->addWidget(mButtonPoint, 0, Qt::AlignTop);
layoutHorizontal->addWidget(mButtonSquare, 0, Qt::AlignTop);
layoutHorizontal->addWidget(mButtonCircle, 0, Qt::AlignTop);
layoutHorizontal->addWidget(mButtonCustom, 0, Qt::AlignTop);
mHorizontalGroupBox = new QGroupBox(tr(""));
mHorizontalGroupBox->setLayout(layoutHorizontal);
@ -102,8 +108,9 @@ void CSVWidget::TextureBrushWindow::configureButtonInitialSettings(QPushButton *
void CSVWidget::TextureBrushWindow::setBrushTexture(std::string brushTexture)
{
mBrushTexture = brushTexture;
mBrushTextureLabel = "Brush:" + mBrushTexture;
mBrushTextureLabel = "Selected texture (id): " + mBrushTexture;
mSelectedBrush->setText(QString::fromStdString(mBrushTextureLabel));
emit passBrushShape(mBrushShape); // update icon
}
void CSVWidget::TextureBrushWindow::setBrushSize(int brushSize)
@ -131,19 +138,36 @@ CSVWidget::SceneToolTextureBrush::SceneToolTextureBrush (SceneToolbar *parent, c
mTextureBrushWindow(new TextureBrushWindow(this))
{
setAcceptDrops(true);
if(mTextureBrushWindow->mBrushShape == 0) setIcon (QIcon (QPixmap (":scenetoolbar/brush-point")));
if(mTextureBrushWindow->mBrushShape == 1) setIcon (QIcon (QPixmap (":scenetoolbar/brush-square")));
if(mTextureBrushWindow->mBrushShape == 2) setIcon (QIcon (QPixmap (":scenetoolbar/brush-circle")));
if(mTextureBrushWindow->mBrushShape == 3) setIcon (QIcon (QPixmap (":scenetoolbar/brush-custom")));
connect(mTextureBrushWindow, SIGNAL(passBrushShape(int)), this, SLOT(setButtonIcon(int)));
setButtonIcon(mTextureBrushWindow->mBrushShape);
}
void CSVWidget::SceneToolTextureBrush::setButtonIcon (int brushShape)
{
if(brushShape == 0) setIcon (QIcon (QPixmap (":scenetoolbar/brush-point")));
if(brushShape == 1) setIcon (QIcon (QPixmap (":scenetoolbar/brush-square")));
if(brushShape == 2) setIcon (QIcon (QPixmap (":scenetoolbar/brush-circle")));
if(brushShape == 3) setIcon (QIcon (QPixmap (":scenetoolbar/brush-custom")));
QString tooltip = "Brush settings <p>Currently selected: ";
if(brushShape == 0)
{
setIcon (QIcon (QPixmap (":scenetoolbar/brush-point")));
tooltip += dynamic_cast<QString&> (mTextureBrushWindow->toolTipPoint);
}
if(brushShape == 1)
{
setIcon (QIcon (QPixmap (":scenetoolbar/brush-square")));
tooltip += dynamic_cast<QString&> (mTextureBrushWindow->toolTipSquare);
}
if(brushShape == 2)
{
setIcon (QIcon (QPixmap (":scenetoolbar/brush-circle")));
tooltip += dynamic_cast<QString&> (mTextureBrushWindow->toolTipCircle);
}
if(brushShape == 3)
{
setIcon (QIcon (QPixmap (":scenetoolbar/brush-custom")));
tooltip += dynamic_cast<QString&> (mTextureBrushWindow->toolTipCustom);
}
tooltip += "<p>Selected texture: " + QString::fromStdString(mTextureBrushWindow->mBrushTexture);
tooltip += "<br>(drop texture here to change)";
setToolTip (tooltip);
}
void CSVWidget::SceneToolTextureBrush::showPanel (const QPoint& position)

@ -50,14 +50,18 @@ namespace CSVWidget
QPushButton *mButtonSquare = new QPushButton(QIcon (QPixmap (":scenetoolbar/brush-square")), "", this);
QPushButton *mButtonCircle = new QPushButton(QIcon (QPixmap (":scenetoolbar/brush-circle")), "", this);
QPushButton *mButtonCustom = new QPushButton(QIcon (QPixmap (":scenetoolbar/brush-custom")), "", this);
BrushSizeControls* mSizeSliders = new BrushSizeControls(tr(""), this);
QString toolTipPoint = "Paint single point";
QString toolTipSquare = "Paint with square brush";
QString toolTipCircle = "Paint with circle brush";
QString toolTipCustom = "Paint custom selection (not implemented yet)";
BrushSizeControls* mSizeSliders = new BrushSizeControls("Brush size", this);
int mBrushShape;
int mBrushSize;
std::string mBrushTexture;
private:
QLabel *mSelectedBrush;
QGroupBox *mHorizontalGroupBox;
int mBrushSize;
std::string mBrushTexture;
std::string mBrushTextureLabel;
public slots:

Loading…
Cancel
Save