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 -
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 layoutQLayoutItem *child;
while ((child = dockWidget->widget()->layout()->takeAt(0)) != 0)
{
delete child;
}
// clear mapmap.clear();
}// Called from Open File slot
void MainWindow::createFromFile( const QString &fileName );
{
if( fileName.isEmpty());
return;
// clean upclearAll();
// 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 upfile. 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)
-
[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.
-