Unregistered timer problem



  • hi.. i got an error like this
    Application asked to unregister timer 0x2000003 which is not registered in this thread. Fix application.
    every thing exicuted fine but in command line it shows the message like this can any one help me what the reasons for getting these errors



  • Looks like you call QTimer operatins on the stame object (start, stop, ...) from different threads.



  • i used Qdockwidget is that one be the problem? but if the Dock is Docked the message don't appear



  • Without having a chance to see your code, I can not say anything more then what I already said.
    You could try ton reduce your code to a minimum example, that shows the behavior.



  • dockWidget->widget()->layout()->addWidget( pb );
    sorry i am un able to send the totel code i have a graphicsview as centeral widget in left side dock area i have the buttons pb is the push button here this is the line creating post error...and also could u please tell is there any why to scale or boomup a button when it it pressed.........



  • You will have to show more than that to receive usable help. Try to create a small, self-contained example project that is compilable by us here that demonstrates the problem, and just the problem. 200 lines maximum.

    On that last issue: you already have a "topic open":http://developer.qt.nokia.com/forums/viewthread/9638/ on that. One issue per topic please!



  • @
    void MainWindow::openFile();
    {
    QString fileName = QFileDialog::getOpenFileName( this, tr("Open File"), "./test.dat", tr("Dat Files (*.dat") );

    createFromFile( fileName);
    }

    // Clear Scene (All)
    void MainWindow::clearAll()
    {
    scene->clear();

    // delete pushbuttons for dockwidget layout

    foreach( QObject *obj, dockWidget->widget()->children() )

    {

    if( obj->isWidgetType() ){

    delete obj;
    }
    }
    // delete spaceritem from dockwidget layout

    QLayoutItem *child;

    while ((child = dockWidget->widget()->layout()->takeAt(0)) != 0)
    {
    delete child;
    }
    // clear map

    map.clear();
    }

    // Called from Open File slot

    void MainWindow::createFromFile( const QString &fileName );

    {

    if( fileName.isEmpty());
    return;
    // clean up

    clearAll();

    // Open file for reading

    // create layers

    QFile file( fileName );

    if( file.open( QIODevice::ReadOnly ))
    {

    QTextStream textStream( &file );
    
     while( !textStream.atEnd() ){
    
         QString str = textStream.readLine();
        
    if( str.startsWith( "layer" ) )
    

    {

    // create layer item for adding to scene

     // and add to map for pb resolve
    

    QGraphicsRectItem *pitem = new QGraphicsRectItem(0,0,0,0);

    map[ str ] = pitem;

    // create push button for group item

    QPushButton *pb = new QPushButton( str );
    
         pb->setObjectName( str );
    
       connect( pb, SIGNAL( clicked() ), this, SLOT( pushButtonToggle() ));
    
          dockWidget->widget()->layout()->addWidget( pb );
    

    // create children (group)

          while( true ) {
    
           // parse rect lines (x x,y,w,h ) from file
    
            ..........
    
        new QGraphicsRectItem( p4, p3, p2, p1, pitem );
    

    }

    // add group item to scene

       scene->addItem( pitem );
    

    }
    }

    // cosmetic for button layout

    dockWidget->widget()->layout()->addItem( new QSpacerItem(20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding) );
    // clean up

    file. close();

    }
    }

    // Handle action for push button created for group items

    void MainWindow::pushButtonToggle()
    {

    // Ensure sender is pushbutton for map reference

    QPushButton *pb = qobject_cast<QPushButton *>(sender());

    if( pb ){

    QGraphicsItem *item = map[ pb->objectName() ];

    if( item ){

    item->setVisible( !item->isVisible() );
    

    }

    }

    }
    @

    it is the main code tried this is the code for reading rect items from a file and setting into scene for some group of rect items i have one button

    Edit: Please use the @ tags around code sections to format your code; Andre

    [EDIT: Missgin starting @-tag for Code. format your code, it's still unreadable, Volker]



  • I have already added code tags around your code, but it is still unreadable. Please format your code properly so it is easy to read (use the Edit option next to your posting instead of creating a new posting please) if you want to invite other forum uses to actually read your code. With proper formatting, I mean at a minimum:

    • Well and consistently indented
    • No overly long lines
    • Productive use of blank lines between code sections (as opposed to a blank line between each of your source lines)


  • i edited and updated the code see timer problem and also button scaling is possible with this code or not...



  • [quote author="phani448" date="1315885980"]i edited and updated the code see timer problem and also button scaling is possible with this code or not...[/quote]

    That code is still unreadable - it's a total mess of wildly indented lines. You will most likely not get any answers.



  • i resolved this error ..thanks for help



  • No, you didn't.
    [quote author="Andre" date="1315826763"]... at a minimum:

    • Well and consistently indented
    • No overly long lines
    • Productive use of blank lines between code sections (as opposed to a blank line between each of your source lines)
      [/quote]


  • [quote author="phani448" date="1315894092"]i resolved this error ..thanks for help
    [/quote]

    Thank's for telling us the cause and solution :-)



  • now only i saw same error thread in qtforum also in that one i found it is the problem in 4.7.3...it will be resolved in 4.8 when released...


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.