1 Attachment(s)
Custom item widgets are flat.
I have a class which is custom widget for QTableWidgetItem. Using Qt 4.8 everything was OK, but in Qt 5.2.1 there is a problem.
My widget class:
Code:
class QTableCalendarWidget
: public QWidget{
Q_OBJECT
public:
QTableCalendarWidget
(QString ToolTip,
bool Ev,
bool BDay
) {
Date
=QDate::fromString(ToolTip,
"d/MM/yyyy");
w.fill(Qt::transparent);
if(Ev)
{
Event
->setPixmap
(QIcon(":/cal/Ev").
pixmap(15));
}
else
{
Event->setPixmap(w);
}
if(BDay)
{
Birth
->setPixmap
(QIcon(":/cal/BDay").
pixmap(15));
}
else
{
Birth->setPixmap(w);
}
Label->setAlignment(Qt::AlignHCenter);
Add->setStyleSheet("QPushButton {border: 0px solid white;}");
Add->setDisabled(true);
connect(Add,SIGNAL(clicked()),this,SLOT(addIN()));
Layout->setSpacing(1);
Layout->addWidget(Event);
Layout->addWidget(Birth);
Layout->addWidget(Label,Qt::AlignHCenter);
Layout->addWidget(Add);
this->setLayout(Layout);
}
void AddB()
{
Add->setEnabled(true);
Add
->setIcon
(QIcon(QIcon(":/main/Add").
pixmap(12,
12)));
}
private:
private slots:
void addIN()
{
emit addOUT(Date);
}
signals:
};
I am setting widget this way:
Code:
QTableCalendarWidget *Day=new QTableCalendarWidget(Items[i]->toolTip(),Ev,Bd);
Calendar->setCellWidget(Items[i]->row(),Items[i]->column(),Day);
Where Items[i] is QTableWidgetItem already added to QTableWidget, with date as a ToolTip.
The appearance:Attachment 10339
As all of you can see the custom widget is flat. Standard QTableWidgetItem is visible normally.
Re: Custom item widgets are flat.
What do you mean by "the custom widget is flat"?
Re: Custom item widgets are flat.
The widget is 1 px high. In previous version widget height was a cell height. Is there any way of changing it without calling resize()? Resizing cause that text is out of cell.