Giter VIP home page Giter VIP logo

Comments (5)

paceholder avatar paceholder commented on May 30, 2024

Hi! Thanks for submitting the bug. It it strange that the hight is limited. I will have a look

from nodeeditor.

paceholder avatar paceholder commented on May 30, 2024

Could you please share the code where you construct the model's widget?
I can't reproduce the issue.

image

from nodeeditor.

ArnaudGallardo avatar ArnaudGallardo commented on May 30, 2024

The specific node I showed on my first post was dynamically generated, so there is no specific code I can give you to duplicate except the whole project. I thought that maybe my "dynamic node creation system" might be the one messing up with the graphics so I added the NaiveDataModel from the connection_colors example to my project and changed the "embeddedWidget" to this piece of code :

QWidget *
  embeddedWidget() override { //return nullptr;
    QFormLayout * layout = new QFormLayout;
    for (int i = 0; i < 15; i++)
    {
        QLineEdit * le = new QLineEdit;
        QString s = QString::number(i);
        layout->addRow(s,le);
    }
    QWidget * widget = new QWidget;
    widget->setLayout(layout);
    widget->setMaximumSize(widget->sizeHint());
    return widget;
  }

Here are the results :
tests

I tried different styling options to be sure that it has nothing to do with it.

Here is another example with more rows :
screen shot 2017-05-19 at 9 20 29 am

Also, I'm doing this to set nodeeditor as the central widget of my main project, maybe it's where the problem comes from... :

NodeEditor::NodeEditor()
{
    ::setStyle();

    scene = new FlowScene(registerDataModels());
    this->view = new FlowView(scene);
}

QWidget *
NodeEditor::getWidget()
{
    return ((QGraphicsView *)(this->view));
}
//NodeEditor is one of my class.

from nodeeditor.

ArnaudGallardo avatar ArnaudGallardo commented on May 30, 2024

Alright, that's not a bug, that's just me.
When I first wrote my function I took your calculator/NumberSourceDataModel.cpp as example where the widget creation is :

_lineEdit->setValidator(new QDoubleValidator());

_lineEdit->setMaximumSize(_lineEdit->sizeHint());

connect(_lineEdit, &QLineEdit::textChanged,
          this, &NumberSourceDataModel::onTextEdited);

_lineEdit->setText("0.0");

So I also used setMaximumSize to create my widget and got a wrong result.

I changed it to setMinimumSize and got :
screen shot 2017-05-19 at 9 44 25 am

So I'm finally using :

widget->setMinimumHeight(widget->sizeHint().height());
widget->setMaximumWidth(widget->sizeHint().width());

And now the result is fine :
screen shot 2017-05-19 at 9 43 34 am

from nodeeditor.

paceholder avatar paceholder commented on May 30, 2024

I guess one does not need to set the size explicitly. From what I know it works just fine with the automatically defined size. Anyway, nice that it finally works.

from nodeeditor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.