Like keeping a bunch of template snippets that you recompose? Not sure if you’re speaking from experience or just winging it, but this sounds like a really good idea.
I was going to say that no, css and dynamic properties don’t mix. Anything that has to change at run-time, I change via Python and in some cases by re-setting stylesheets via in-line css on particular widgets; generally avoiding re-setting stylesheets on the entire application due to performance concerns. Having “css snippets” sounds really powerful and aligns well with another methodology I use. I’m mocking up a new thread on CSS as we speak, let’s continue our discussions in there. On 6 June 2014 21:48, Justin Israel <[email protected]> wrote: > Does that mean when wanting to change size constraints dynamically, you > have to rewrite and assign new css strings? Like keeping a bunch of > template snippets that you recompose? Like if I wanted to adjust the min > height constraint on a widget in response to certain situation. > > > On Sat, Jun 7, 2014 at 1:45 AM, Marcus Ottosson <[email protected]> > wrote: > >> Yeah, sizing via CSS is great. I use Python for structure only, all >> look-related things go via CSS, including min, max, fixed sizes. Keeps a >> clean separation, and resembles HTML with CSS if your familiar with that, >> and facilitates having multiple themes too! >> >> In fact I was going to put up a new thread about SCSS, to make CSS more >> manageable and pretty. I recommend having a look. >> >> >> On 6 June 2014 14:17, Justin Israel <[email protected]> wrote: >> >>> Glad it was helpful to solve something! There are so many facets to Qt >>> that it is hard to know them all. I haven't actually sized widgets much >>> through CSS so I will keep that in mind. I use CSS for all the other look >>> related stuff. >>> On Jun 7, 2014 12:50 AM, "Marcus Ottosson" <[email protected]> >>> wrote: >>> >>>> Unrelated to the problem at hand, but related to eventFilter, I did >>>> already find a good use for them. >>>> >>>> When sizing things via CSS, widgets aren't resized immediately but are >>>> delayed towards the point where the widget is about to be shown. So asking >>>> a widget for it's size when running the application would yield incorrect >>>> results. >>>> >>>> The way I dealt with it previously was to run QWidget.ensurePolished(), >>>> but that only worked on a per-widget occasion, meaning I'd have to cascade >>>> the call to each child widget for accurate results. >>>> >>>> Now, instead of calling upon the method querying the sizes directly, I >>>> posted an event, picked up in an eventFilter during QEvent.Show and fired a >>>> call from there to the method making the queries, and the sizes are >>>> correct. >>>> >>>> I've been missing out. :) >>>> >>>> Thanks for the tip Justin, I've had such a hard time with this >>>> particular issue for a long time. >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Python Programming for Autodesk Maya" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOB1oMtPyRAbcWSUb-PJ0TGwHDZ%2BpJPMoDvaNZTdqXDf-A%40mail.gmail.com >>>> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOB1oMtPyRAbcWSUb-PJ0TGwHDZ%2BpJPMoDvaNZTdqXDf-A%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Python Programming for Autodesk Maya" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2_W7Ai79wJ9_NXqj-ypz3CJ%3DFb7MdcbvxAG84JFQumJg%40mail.gmail.com >>> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2_W7Ai79wJ9_NXqj-ypz3CJ%3DFb7MdcbvxAG84JFQumJg%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> *Marcus Ottosson* >> [email protected] >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Python Programming for Autodesk Maya" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOAkwM7GD_W9278Dae-5EDh4Nb-_VNnpHu8oACo1ESGpZA%40mail.gmail.com >> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOAkwM7GD_W9278Dae-5EDh4Nb-_VNnpHu8oACo1ESGpZA%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0hi00L9fs4z8fxc%2B1qZByvkUhJ5NxEnrtR5o1omX0DXw%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0hi00L9fs4z8fxc%2B1qZByvkUhJ5NxEnrtR5o1omX0DXw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- *Marcus Ottosson* [email protected] -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBeC1xLLkm31eaz8M62ZHTw-C8EVc6fqy1rNPZqw7shmw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
