Results 1 to 5 of 5

Thread: Rquest for member show() is ambiguous

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2011
    Location
    Denmark
    Posts
    74
    Qt products
    Qt4
    Platforms
    MacOS X Windows
    Thanks
    7
    Thanked 10 Times in 9 Posts

    Default Re: Rquest for member show() is ambiguous

    It's because of the multiple inheritance. You should avoid multiple inheritance except in the case of pure virtual classes.(interfaces)

    Both QDialog and QCalendarWidget have a show function so when PainterApp::show is called it doesn't know whether to call the show from QDialog or from QCalendarWidget.

    Redesign your class to only extend QDialog and add a QCalendarWidget to it's ui.

  2. #2
    Join Date
    Apr 2011
    Posts
    25
    Qt products
    Qt/Embedded
    Platforms
    Symbian S60

    Default Re: Rquest for member show() is ambiguous

    ok I am sending my code u please check it..now no error signifies but nothing display in the cell..

    Qt Code:
    1. namespace Ui {
    2. class PainterApp;
    3. }
    4. class MyCalendarWidget : public QCalendarWidget
    5. {
    6. private:
    7. Ui::PainterApp *ui;
    8. protected:
    9. virtual void paintCell(QPainter* painter, const QRectF& rect, const QDate& date);
    10.  
    11. };
    12. class PainterApp : public QDialog
    13. {
    14. Q_OBJECT
    15.  
    16. public:
    17. explicit PainterApp(QWidget *parent = 0);
    18. ~PainterApp();
    19.  
    20. private:
    21. Ui::PainterApp *ui;
    22. private slots:
    23.  
    24. };
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. #include "painterapp.h"
    2. #include "ui_painterapp.h"
    3.  
    4. PainterApp::PainterApp(QWidget *parent) :
    5. QDialog(parent),
    6. ui(new Ui::PainterApp)
    7. {
    8. ui->setupUi(this);
    9.  
    10. }
    11. void MyCalendarWidget::paintCell(QPainter* painter, const QRectF& rect, const QDate& date)
    12. {
    13.  
    14. rect(30.0, 40.0, 80.0, 60.0);
    15. QImage image("C:/QTWork/back-icon.png");
    16.  
    17.  
    18. painter->drawImage(rect, image, rect);
    19. ui->calendarWidget->paintCell(painter,rect,date.currentDate());
    20. }
    To copy to clipboard, switch view to plain text mode 
    regards
    Anshuman

Similar Threads

  1. ambiguous documentation and behavior of QTcpSocket
    By moviemax in forum General Programming
    Replies: 1
    Last Post: 5th June 2010, 00:11
  2. ambiguous connect()
    By Cruz in forum Qt Programming
    Replies: 2
    Last Post: 27th August 2009, 12:35
  3. Replies: 22
    Last Post: 8th October 2008, 14:54
  4. `QObject' is an ambiguous base of `ClientThread'
    By probine in forum Qt Programming
    Replies: 1
    Last Post: 7th December 2006, 14:17
  5. Replies: 5
    Last Post: 29th January 2006, 18:00

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
  •  
Qt is a trademark of The Qt Company.