Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: Change width in TextItem  (Read 3956 times)

seetharaman

  • Newbie
  • *
  • Posts: 10
    • View Profile
Change width in TextItem
« on: July 19, 2016, 03:04:39 PM »
how to change width in textitem ?

Example

THIS.width=40;
« Last Edit: July 19, 2016, 03:10:51 PM by seetharaman »

Subst

  • Sr. Member
  • ****
  • Posts: 444
    • View Profile
Re: Change width in TextItem
« Reply #1 on: July 20, 2016, 12:54:06 PM »
may be by using script engine?

it's like the ecma-262, i.e. JS & so

http://www.ecma-international.org/ecma-262/7.0/

Arin Alex

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 992
    • View Profile
Re: Change width in TextItem
« Reply #2 on: July 21, 2016, 12:33:38 AM »
I've added method setItemWidth and setItemHeight to TextItem.
You can use like this $S{THIS.setItemWidth(40)}
I can't add it as a property for some reason

seetharaman

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Change width in TextItem
« Reply #3 on: July 21, 2016, 07:56:36 AM »
thank you very much

seetharaman

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Change width in TextItem
« Reply #4 on: July 21, 2016, 08:52:17 AM »
Its Return Some error message.
and attached my file

TypeError:Result of expression 'THIS.setItemWidth' [undefined] is not a function

[вложение удалено администратором]

Arin Alex

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 992
    • View Profile
Re: Change width in TextItem
« Reply #5 on: July 21, 2016, 10:10:11 AM »
Did you get the latest source from github ? I added this function after your message.

seetharaman

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Change width in TextItem
« Reply #6 on: July 21, 2016, 11:51:35 AM »
it's work properly .

is designer open sourced? if so, where to find source code?

Arin Alex

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 992
    • View Profile
Re: Change width in TextItem
« Reply #7 on: July 21, 2016, 12:51:24 PM »
I've pushed it to githib.

seetharaman

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Change width in TextItem
« Reply #8 on: July 21, 2016, 12:58:00 PM »
thank you very much

Muthu Samy

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Change width in TextItem
« Reply #9 on: July 25, 2016, 06:47:15 AM »
Feature request: Simalarly, functions needed for setting x & y positions of an Item..

Alternatively, we can make QRectF new-able from script (similar to QColor, so that a QRectF can be assigned to Geometry property)

Arin Alex

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 992
    • View Profile
Re: Change width in TextItem
« Reply #10 on: July 25, 2016, 03:30:54 PM »
I added next functions to Item :
    Q_INVOKABLE qreal getItemWidth();
    Q_INVOKABLE qreal getItemHeight();
    Q_INVOKABLE qreal getItemPosX();
    Q_INVOKABLE qreal getItemPosY();
    Q_INVOKABLE QString setItemPosX(qreal xValue);
    Q_INVOKABLE QString setItemPosY(qreal yValue);