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

Author Topic: Change width in TextItem  (Read 6514 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: 450
    • 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: 1005
    • 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: 1005
    • 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: 1005
    • 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: 1005
    • 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);