Results 1 to 3 of 3

Thread: QTextEdit print segmentation fault

  1. #1
    Join Date
    Jul 2015
    Posts
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default QTextEdit print segmentation fault

    Hi,

    if i select in the print dialog the "MS XPS Document Writer" for printing (WIN 7), a file dialog will be opened. If this dialog will be canceled (by user) -> segementation fault (in line 4) - qt bug - or can i check something more? When a file name will be entered -> no problem.

    Qt Code:
    1. QPrinter printer;
    2. QPrintDialog *dlg = new QPrintDialog(&printer, this);
    3. if (dlg->exec() == QDialog::Accepted) {
    4. ui->q_text_edit->print(&printer);
    5. }
    6. delete dlg;
    To copy to clipboard, switch view to plain text mode 

    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QTextEdit print segmentation fault

    How can line 4 be reached if the dialog has been cancelled?

    Cheers,
    _

  3. #3
    Join Date
    Jul 2015
    Posts
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QTextEdit print segmentation fault

    Hi,

    Line 4 is reached when the Print Button in the Print Dialog is pressed (maybe to early)

    Current sequence:
    (for information: "MS XPS Document Writer" is writting the print in a file)

    1. in the Qt Application press Button "Print"
    2. MS Print Dialog is opened (Application is waiting on Line 3)
    3. in the MS Print Dialog press Button "Print" (Application go to 4 and wait) and a File Dialog is opend from MS
    4. in this File Dialog press cancel -> segmentation fault (if a new file name is entered -> all is fine)

    From my point of view Line 3 is to early executed.

    Best regards

Similar Threads

  1. Segmentation Fault
    By Ryan Riffle in forum Qt Programming
    Replies: 4
    Last Post: 16th January 2011, 20:52
  2. QWT - Segmentation Fault
    By Wojtek.wk in forum Newbie
    Replies: 0
    Last Post: 17th April 2010, 14:29
  3. Segmentation Fault
    By jmc in forum Qt Tools
    Replies: 4
    Last Post: 24th February 2010, 20:08
  4. segmentation fault
    By mattia in forum Newbie
    Replies: 22
    Last Post: 7th November 2007, 10:37
  5. (Another) segmentation fault
    By Lebowski in forum Qt Programming
    Replies: 27
    Last Post: 6th April 2006, 06:33

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.