| Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date | |
| All threads index page 2 | |
Hi What is the correct way to create a single-line QTextEdit widget? Basically I just want a QLineEdit-style widget with support for rich text editing. thanks Matt
hi, Anybody succeded in using the drawArea method of QCanvas? i'm trying to save a rect from the canvas to a QPicture or a QPixmap but i need the rect's top left corner to be different from (0,0) ( eg. QRect (50,50,50,50) ). drawArea() seems to be printing on the QPixmap the hole canvas ... ignoring the rect i pass. QPixmap px; px.resize(500,500); px.fill(white); QPainter p(&px); canvas()->drawArea(QRect(50,50,50,50),&p); p.end(); the canvas is w=500, h=500 and all the canvas ends up in px (the QPixmap) any ideeas?? -- [ signature omitted ]
Attachment:
pgpBwoBmD7dDQ.pgp
Description: PGP signature
ah... found it ... it seeams that using double buffering solves the problem . hope this helps someonelse . On Thursday 07 April 2005 17:54, Iulian M wrote: > hi, > > Anybody succeded in using the drawArea method of QCanvas? > > i'm trying to save a rect from the canvas to a QPicture or a QPixmap but i > need the rect's top left corner to be different from (0,0) ( eg. > QRect (50,50,50,50) ). drawArea() seems to be printing on the QPixmap the > hole canvas ... ignoring the rect i pass. > > > QPixmap px; > px.resize(500,500); > px.fill(white); > QPainter p(&px); > canvas()->drawArea(QRect(50,50,50,50),&p); > p.end(); > > the canvas is w=500, h=500 and all the canvas ends up in px (the QPixmap) > > any ideeas?? -- [ signature omitted ]
Attachment:
pgpZZ5FMICsaP.pgp
Description: PGP signature
Hi Matt, Subclass QTextEdit and then, 1. Disable word wrap. 2. Disable the scroll bars (AlwaysOff). 3. setTabChangesFocus(true). 4. Set the sizePolicy to Expanding:Fixed. 4. Handle return keypress correctly. 5. Reimplement sizeHint to return size depending on the font. Should be very similar to the code in QLineEdit::sizeHint(). 7. If you dont use a layout, resize(sizeHint()). Hope I didn't miss anything :) Girish Matt Spong wrote: > Hi > > What is the correct way to create a single-line QTextEdit widget? > Basically I just want a QLineEdit-style widget with support for rich > text editing. > > thanks > Matt