On Wednesday 22 October 2008, Aaron J. Seigo wrote: > On Wednesday 22 October 2008, Marco Martin wrote: > > rows to make room for that ghost dead third row and seems there is no way > > to really reset it (and no, there was absolutely no updates to > > graphicslayouts in qt4.5tp not a single line changed :/ ). > > ugh. this is really bad. and probably means that whenever we change row #, > we'll have to delete and recreate the layout. the baby jesus weeps.
update: replicating the scenario with the very simple test program attached the problem doesn't appear. but if in the taskbar i explicitly remove all the items from the layout before a relayout the problem is still here, i.e the debug output says it placed only items in the first row but items are resized as the rows were two so the situation is weirder and weirder, it doesn't seem a bug of the grid layout but something at our end, this gives hope but seems tricky i suspect has something to do with size hints and preferred sizes, will do some more experiments later today. hopefully the solution is way simpler than it seemed in the first place :D Cheers, Marco Martin
#include <QApplication> #include <QGraphicsScene> #include <QGraphicsView> #include <QGraphicsWidget> #include <QDebug> #include <QStyleOptionGraphicsItem> #include <QGraphicsGridLayout> class TestWidget : public QGraphicsWidget { public: TestWidget(QGraphicsItem * parent = 0, Qt::WindowFlags wFlags = 0 ); ~TestWidget(); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); QColor background; }; TestWidget::TestWidget(QGraphicsItem * parent, Qt::WindowFlags wFlags) : QGraphicsWidget(parent, wFlags ) { background = Qt::green; } TestWidget::~TestWidget() {} void TestWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { painter->fillRect(option->rect, background); } int main(int argc, char **argv) { QApplication app(argc, argv); QGraphicsScene scene; TestWidget *outerWidget = new TestWidget(0,Qt::Window); outerWidget->background = Qt::red; outerWidget->resize(100,100); QGraphicsGridLayout *lay = new QGraphicsGridLayout(outerWidget); outerWidget->setWindowFrameMargins(10,10,10,10); scene.addItem(outerWidget); TestWidget *widget00 = new TestWidget(outerWidget); TestWidget *widget01 = new TestWidget(outerWidget); TestWidget *widget10 = new TestWidget(outerWidget); TestWidget *widget11 = new TestWidget(outerWidget); lay->addItem(widget00,0,0); lay->addItem(widget01,0,1); lay->addItem(widget10,1,0); lay->addItem(widget11,1,1); lay->removeAt(2); lay->removeAt(2); QGraphicsView view(&scene); view.show(); return app.exec(); }
_______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel