Author Topic: Non-gui Qt app launched from Applications  (Read 2677 times)

tblumer

  • Newbie
  • *
  • Posts: 38
    • View Profile
    • http://sdgsystems.com
Non-gui Qt app launched from Applications
« on: April 22, 2004, 07:31:43 pm »
I need to write a simple application that is launched from the normal Applications tab, but has no GUI output (unless there is an error). It also must not change keyboard focus from the current application that\'s running. (The user can assign a button press to it.) It\'s easy enough to do a simple widget that does something, then exits, but the waiting hourglass remains, as does the \"explosion\" launch graphic. Basically, I want a button press to trigger an event in the background and have it work from any application. Any suggestions?

tblumer

  • Newbie
  • *
  • Posts: 38
    • View Profile
    • http://sdgsystems.com
Non-gui Qt app launched from Applications
« Reply #1 on: April 22, 2004, 07:35:24 pm »
More specifically, here\'s what I\'m trying, but as you can see by the comment, the screen flickers momentarily.

Trigger::Trigger( QWidget *parent, const char *name, WFlags fl )
    : QWidget( parent, name,  WStyle_Customize | WStyle_NoBorderEx )
{
    p_sdgms = sdgms_init( \"/dev/sdgmhs0\", SDGMS_VERSION );
    if (p_sdgms == NULL)
    {
        QMessageBox::critical(0, \"Not Detected\",
            \"The scanner cannot be detected.  Please make sure it \"
            \"is securely plugged in and try again.\");
        exit(1);
    }
    if (sdgms_open( p_sdgms ) != SDGMS_SUCCESS)
    {
        QMessageBox::critical(0, \"Not Detected\",
            \"The scanner cannot be detected.  Please make sure it \"
            \"is securely plugged in and try again.\");
        exit(1);
    }
    setFixedSize(0,0);  // don\'t make widget appear, screen flickers :-(
    setDisabled(TRUE);
    QTimer::singleShot( 0, this, SLOT(scanon()) );
}
 
Trigger::~Trigger( void )
{
    sdgms_shutdown( p_sdgms );
}
 
void
Trigger::scanon( void )
{
    (void) sdgms_trigger( p_sdgms, SDGMS_TRIGGER_ON, NULL, NULL );
}

lpotter

  • Sr. Member
  • ****
  • Posts: 450
    • View Profile
    • http://qtopia.net
Non-gui Qt app launched from Applications
« Reply #2 on: May 08, 2004, 06:03:42 pm »
can you try using hide() ?
Software Engineer, Systems Group, MES, Trolltech
irc.freenode.net #qtopia
http://qtopia.net