{
if(rosterTipLabel::instance && rosterTipLabel::instance->index()==idx)
return;
int scr;
else
#ifdef Q_WS_WIN
24
#else
16
#endif
);
rosterTipLabel
*label
=new rosterTipLabel
(idx,
QApplication::desktop()->screen
(scr
));
label->move(p);
label->show();
}
void rosterWidget::paintToolTip(const QModelIndex &idx, const QPoint &pos, QWidget *w) // JUST SHOW TOOLTIP
{
if(rosterTipLabel::instance && rosterTipLabel::instance->index()==idx)
return;
int scr;
if (QApplication::desktop()->isVirtualDesktop())
scr = QApplication::desktop()->screenNumber(pos);
else
scr = QApplication::desktop()->screenNumber(w);
QPoint p = pos;
p += QPoint(2,
#ifdef Q_WS_WIN
24
#else
16
#endif
);
rosterTipLabel *label=new rosterTipLabel(idx,QApplication::desktop()->screen(scr));
label->move(p);
label->show();
}
To copy to clipboard, switch view to plain text mode
{
delete instance;
instance=this;
setAutoFillBackground(TRUE);
setFrameStyle
(QFrame::NoFrame);
setAlignment(Qt::AlignLeft);
// setAttribute(Qt::WA_NoSystemBackground); // I WAS TRYING THIS WITH SAME EFFECT AS WA_OpaquePaintEvent
setAttribute(Qt::WA_OpaquePaintEvent);
qApp->installEventFilter(this);
hideTimer.start(10000, this);
img=(index.model()->data(index,FotoRole)).value<QImage>();
status=(index.model()->data(index,Qt::DecorationRole)).value<QImage>();
nick=(index.model()->data(index,Qt::DisplayRole)).toString();
descr=(index.model()->data(index,DescriptionRole)).toString();
idx=index;
QColor(255,
255,
220,
255) /*button*/,
QColor(255,
255,
220,
255) /*light*/,
QColor(255,
255,
220,
255) /*dark*/,
QColor(255,
255,
220,
255) /*mid*/,
QColor(255,
255,
220,
255) /*text*/,
QColor(255,
255,
220,
255) /*bright_text*/,
QColor(255,
255,
220,
255)/*base*/,
QColor(255,
255,
220,
255)/*window*/);
qDebug()<<(pal.window()).isOpaque(); //always prints true
setPalette(pal);
}
rosterTipLabel::rosterTipLabel(const QModelIndex &index,QWidget *parent): QLabel(parent, Qt::ToolTip)
{
delete instance;
instance=this;
setAutoFillBackground(TRUE);
setFrameStyle(QFrame::NoFrame);
setAlignment(Qt::AlignLeft);
// setAttribute(Qt::WA_NoSystemBackground); // I WAS TRYING THIS WITH SAME EFFECT AS WA_OpaquePaintEvent
setAttribute(Qt::WA_OpaquePaintEvent);
qApp->installEventFilter(this);
hideTimer.start(10000, this);
img=(index.model()->data(index,FotoRole)).value<QImage>();
status=(index.model()->data(index,Qt::DecorationRole)).value<QImage>();
nick=(index.model()->data(index,Qt::DisplayRole)).toString();
descr=(index.model()->data(index,DescriptionRole)).toString();
idx=index;
QPalette pal( QColor(255,255,220,255) /*windowText*/,
QColor(255,255,220,255) /*button*/,
QColor(255,255,220,255) /*light*/,
QColor(255,255,220,255) /*dark*/,
QColor(255,255,220,255) /*mid*/,
QColor(255,255,220,255) /*text*/,
QColor(255,255,220,255) /*bright_text*/,
QColor(255,255,220,255)/*base*/,
QColor(255,255,220,255)/*window*/);
qDebug()<<(pal.window()).isOpaque(); //always prints true
setPalette(pal);
}
To copy to clipboard, switch view to plain text mode
Bookmarks