×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    6

    Question Image alignment on softkeys

    Hi, I've been googling for hours and couldn't find any answer to my question. Nothing apparent on documentation either.

    First, I'm developing with the latest Qt, for my N8. I'm trying to create a softkey with the image center aligned. I've tried a lot of things (including style sheets, but I don't know if I did it properly). The code I used is (inside QWidget constructor):

    Code:
    QPixmap icon(":/images/myImg");
        QAction *optionsAction = new QAction(QString::null, this);
        optionsAction->setText(QString::null);
        optionsAction->setIconText(QString::null);
        optionsAction->setIcon(icon);
        optionsAction->setIconText(QString::null);
        optionsAction->setMenuRole(QAction::ApplicationSpecificRole);
        optionsAction->setSoftKeyRole(QAction::PositiveSoftKey);
        addAction(optionsAction);
    Now, the button in the left side of the standard Exit button get's displayed with the image I selected. I don't need any text, just the image. But it seems impossible to make it in the center position, or better, justified. I can modify the image to make it look like in the center, but that won't work as it will look correctly on my device only.

    What is the correct way to do this?

    Any help is appreciated.

    Kind Regards,
    Fábio

  2. #2
    Regular Contributor
    Join Date
    Oct 2008
    Location
    Oslo, Norway
    Posts
    329

    Re: Image alignment on softkeys

    Hi,

    For something like this you'd need to use native S60/Symbian APIs. You can get the softkey container (CEikButtonGroupContainer) via a static function CEikButtonGroupContainer::Current(). But I'm not sure to which extent the image alignment can be controlled even with native code: You'll notice that in landscape mode, softkeys use different aligment than in portrait.

    As you're able to make it look ok on your device, an ugly hack might be to do something similar to this - i.e. dig out the size of the softkey control, then modify the image accordingly. Look for LSK_POSITION (left softkey) and RSK_POSITION (right softkey) in the above source file, they contain the hard-coded command IDs Qt uses for softkeys. You'll need those for CEikButtonGroupContainer::ControlOrNull().

  3. #3
    Registered User
    Join Date
    Oct 2010
    Posts
    6

    Re: Image alignment on softkeys

    Thanks, I'll download the kernel code and see if I can isolate that. In any case, this seems a lot of trouble to accomplish what should've been a simple task.

    In any case, if I manage to accomplish what I want, I'll post here the steps to accomplish that.

    Kind regards.
    Fábio

Similar Threads

  1. problem in alignment
    By rohitnegi in forum Symbian User Interface
    Replies: 2
    Last Post: 2010-03-11, 05:21
  2. CEikEdwin alignment
    By gammav in forum Symbian User Interface
    Replies: 2
    Last Post: 2008-08-12, 10:04
  3. Help out a noob.....Image alignment problem
    By Roastie in forum Streaming and Video
    Replies: 0
    Last Post: 2006-06-15, 08:47
  4. Help out a noob.....Image alignment problem
    By Roastie in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2006-06-15, 08:47
  5. Alignment CEikLabel
    By vilbrandt in forum Symbian User Interface
    Replies: 2
    Last Post: 2005-01-10, 10:09

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •